Repository navigation
Cache Go modules that differ only in case apart - #540
Merged
Merged
Conversation
Module zips are stored under the module's PURL, which lowercases golang
names, and under the filename {last element}@{version}.zip. So
github.com/Sirupsen/logrus and github.com/sirupsen/logrus shared one
cache entry although upstream serves different zips, and the second one
requested failed go's checksum check.
A module path with capitals now gets a hash of its exact spelling in the
filename. All-lowercase paths keep the plain name, so existing cache
entries stay valid.
A capitalised module cached before this change sits under its lowercase
twin's plain filename. When a cached zip's upstream URL names a different
module path, it is discarded and fetched again. Only the module path is
compared, so a cache filled from another upstream.go host is kept.
Fixes git-pkgs#466
andrew
approved these changes
Oct 21, 2026
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.
Fixes #466.
Go module zips are stored under the module's PURL, which lowercases golang names, and under
{last element}@{version}.zip.github.com/Sirupsen/logrusandgithub.com/sirupsen/logrustherefore shared one cache entry although upstream serves different zips, and whichever was requested second failedgo's checksum check.logrus@v1.0.6~{hash}.zip. All-lowercase paths keep the plain name, so existing cache entries stay valid.upstream.gohost is kept (Changing upstream invalidates the cache #486), and a record whose URL isn't a Go module URL is left alone.Testing
Handler tests fetch both spellings twice and check each gets its own bytes and is fetched once, that a legacy entry for the other spelling is refetched, and that an entry from another upstream host is served from cache. The golang retention test now finds the capitalised module under its new filename.