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

cmd/go: 'go mod download' of a replaced module downloads the go.mod for its replacement #29181

bcmills opened this issue Dec 12, 2018 · 2 comments
GoCommand modules NeedsFix


Copy link

@bcmills bcmills commented Dec 12, 2018

go mod download of a specific version of a module should download only that module.

Today, if that version happens to have a replacement, go mod download also downloads the go.mod file (but not the .zip file) for its replacement.

$ go mod init
go: creating new go.mod: module

$ go mod edit -require
$ go mod edit -replace
$ go mod download -json
go: finding v0.3.0
go: finding v0.2.0
        "Path": "",
        "Version": "v0.2.0",
        "Info": "/tmp/tmp.3uwW75Tyk7/_gopath/pkg/mod/cache/download/",
        "GoMod": "/tmp/tmp.3uwW75Tyk7/_gopath/pkg/mod/cache/download/",
        "Zip": "/tmp/tmp.3uwW75Tyk7/_gopath/pkg/mod/cache/download/",
        "Dir": "/tmp/tmp.3uwW75Tyk7/_gopath/pkg/mod/",
        "Sum": "h1:WtDSLEtcB5GqbjSlyn8XcYtxjw+SgFMc2RILOvq7CuE=",
        "GoModSum": "h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ="

$ find $GOPATH -name '*.mod'

$ find $GOPATH -name '*.zip'
@bcmills bcmills added NeedsFix GoCommand modules labels Dec 12, 2018
@bcmills bcmills added this to the Go1.13 milestone Dec 12, 2018
Copy link
Member Author

@bcmills bcmills commented Dec 12, 2018

(Found while investigating #27868.)

Copy link

@oiooj oiooj commented Dec 16, 2018

I fixed this problem in my local repo, but from the test script:

go mod download will not follow replacements for explicit module queries.

Maybe we need to think about it again.

@andybons andybons removed this from the Go1.13 milestone Jul 8, 2019
@andybons andybons added this to the Go1.14 milestone Jul 8, 2019
@rsc rsc removed this from the Go1.14 milestone Oct 9, 2019
@rsc rsc added this to the Backlog milestone Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
GoCommand modules NeedsFix
None yet

No branches or pull requests

4 participants