Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module resolution issues with v8.0.0 due to v4.0.2+incompatible caching #112

Open
umputun opened this issue Jan 1, 2025 · 2 comments
Open

Comments

@umputun
Copy link
Contributor

umputun commented Jan 1, 2025

Hi! Found an interesting issue with module resolution. When trying to use v8 of tollbooth:

  1. go get github.com/didip/tollbooth/v8 fails with: "go: module github.com/didip/tollbooth@upgrade found (v4.0.2+incompatible), but does not contain package github.com/didip/tollbooth/v8"
  2. At the same time go get github.com/didip/tollbooth/v7 works fine
  3. pkg.go.dev also shows this inconsistency:
  • Shows "Version: v4.0.2+incompatible Latest"
  • While also showing "The highest tagged major version is v8"
image

The issue appears to be related to the old v4.0.2 version which didn't have go.mod and is marked as "+incompatible". This seems to interfere with Go's module resolution for v8, while v7 works fine.

For users, clearing the module cache (go clean -modcache) fixes the issue, but this suggests there might be a problem with how the module versions are published/cached.

Steps to reproduce:

  1. go get github.com/didip/tollbooth/v8 -> fails
  2. go clean -modcache
  3. go get github.com/didip/tollbooth/v8 -> works

I was able to reproduce it on two different computers. Both have been using v7 before.

Would be great to understand why this happens and if there's a way to fix it on the package level.

@umputun
Copy link
Contributor Author

umputun commented Jan 2, 2025

One idea to try/investigate is maybe retracting that troublesome 4.0.2.

I.e. add retract v4.0.2 to go.mod as you release the new hotfix.

@didip
Copy link
Owner

didip commented Jan 2, 2025

So, I tested it on a brand new project and it seems to work:

go mod init
go: creating new go.mod: module github.com/didip/test

go get github.com/didip/tollbooth/v8
go: downloading github.com/didip/tollbooth/v8 v8.0.1
go: added github.com/didip/tollbooth/v8 v8.0.1
go: added github.com/go-pkgz/expirable-cache/v3 v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants