-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go/internal/modfetch: module path validation inconsistent between repo and proxy fetch paths #31428
Comments
I have not looked at this carefully, but my initial suspicion would be a difference in behavior in how v2+ modules with bad If you do
I checked to see if The bad
I would therefore suspect either the |
@shrajfr12 I would wonder if you or one of your colleagues could try reproducing this with a local file-based GOPROXY setting? This could help differentiate if the Perhaps it would not work for some reason, or perhaps it would not be conclusive, but could be worth trying. In general, and I suspect this is extremely well known to you at this point:
In between those two steps, you could try doing
(Those versions are taken from the diff output). |
Also, regarding this (with italics added):
Personally, I would expect the In other words, the hope would be that setting GOPROXY would show a smaller on-disk size for the module download cache, in addition to also executing faster. |
This sounds like a GoCenter bug. In general, It's tempting for proxy owners to try to “fix” module path errors by culling out mismatched versions, but as you've seen that can lead to surprising behavior — and can break modules that use There is probably also a CC @marwan-at-work @heschik @hyangah @katiehockman @jayconrod |
The |
@bcmills I'm not sure if I understood what do you mean by " On GoCenter, Can you provide more details on why do you think it might be a GoCenter bug? |
Btw, the same behavior is happening for a basic With
Without
|
Hmm, that's an interesting observation. Whatever restrictions we apply to the module path found in the |
CC @jayconrod We've been considering relaxing the module path check anyway (to support the |
@thepudds I did the test you suggested and I got the same results I get from GoCenter. Here is what I did and the results:
|
In Athens' case, getting the
The Version that we'd pick is
This seems incorrect behavior to me. @bcmills should GoCenter (or any GOPROXY) be doing this? Shouldn't we just rely on |
@marwan-at-work when resolving a module in this scenario from VCS by running In order to promote compatibility between modules resolved from GoCenter and the ones resolved from VCS, we never touch those files and we use them as is. If we try to fetch module content via
Besides the error, the module is downloaded to the local cache, but as soon as we try to use it we get the following error: → go build ./... If we try to fix this require statement in my working project
BTW, we get the same errors if we try to use
The only way we have found to make a basic |
This issue is currently labeled as early-in-cycle for Go 1.15. That time is now, so friendly ping. If it no longer needs to be done early in cycle, that label can be removed. |
This didn't happen for 1.15. Moving milestone to backlog. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
These are the reproduction steps posted in gocenter gopher slack channel by @thepudds.
mkdir /tmp/scratchpad/hashicorp-vault-1
cd /tmp/scratchpad/hashicorp-vault-1
export GOPROXY='https://gocenter.io'
export GOPATH='/tmp/go-path-for-hashicorp-vault-test-1'
go mod init tempmod
cat < main.go
package x
import (
_ "github.com/hashicorp/vault/api"
)
func main() {}
EOF
go mod tidy
go list -m all | wc -l
go list -m all > list.all.out
find $GOPATH/pkg/mod -name "*.mod" | wc -l
du -sh $GOPATH/pkg/mod
Repeat this in another window with different sets of directories(Replace -1 with -2 for example) but without setting GOPROXY.
You can see the du output in the GOPROXY window to be significantly different in the window without GOPROXY setting and the list of modules (list_all.out) shows difference in the version number for one of the dependencies (github.com/pierrec/lz4)
What did you expect to see?
In the both cases with GOPROXY and without GOPROXY, expect to see the dependencies of modules to be resolved to the same version
What did you see instead?
There is a difference in the du output as well as the content of the list of modules with and without GOPROXY,
With GOPROXY, the modules list shows
github.com/pierrec/lz4 v2.1.1+incompatible // indirect
Without GOPROXY, the modules list shows
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
Please note that the actual dependency based on vendor.json in the project github.com/hashicorp/vault is actually v0.0.0-20181005164709-635575b42742 (go mod init in that project generates this correctly) but go mod tidy overwrites it with a different version.
The text was updated successfully, but these errors were encountered: