Repository navigation
Preserve case in Go module PURLs - #54
Merged
Merged
Conversation
andrew
requested changes
Oct 28, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
Thanks for picking this up — the approach is right and the parse recovery matches packageurl-go's own split for every input FromString accepts as golang. Two small cleanups before merge:
purl.go:92— thestrings.Trimaroundstrings.Join(decoded, "/")is dead: empty segments are already filtered out ofdecoded, so the join can never produce a leading or trailing/. Assignnamespace = strings.Join(decoded, "/")directly.purl.go:121-124—New's godoc lost the invariant it was documenting ("so New and Parse produce the same string for equivalent inputs") in favour of a golang-specific sentence thatpreserveGolangCase's own comment already covers. Please restore the original four lines; "the same per-type rules Parse applies" now covers golang too, since Parse preserves case.
Contributor
Author
|
Addressed both cleanups in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Go module paths are case-sensitive, but packageurl-go lowercases the namespace and name during normalization. Restore the original decoded path components for
golangPURLs so parsing and all construction helpers preserve module identity.Regression coverage exercises literal and percent-encoded uppercase paths through Parse, New, BuildPURLString, MakePURL, and MakePURLString.
Fixes #53
Verification
go build ./...— passed (Go 1.27.3, windows/amd64)go test ./... -count=1— passedgo test -race ./... -count=1— passedgo vet ./...— passedgolangci-lint run --new-from-rev=origin/main— passed, 0 issuesgolangci-lint runreports gofmt findings in unchangedcomparison.go,defaults.go, anddoc.godue to their CRLF checkout; LF-normalized copies are gofmt-clean. No unrelated files were changed.AI assistance: Codex (GPT-6) assisted with implementation and regression tests.