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


Copy link

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 this to the Go1.13 milestone Dec 12, 2018


This comment has been minimized.

Copy link
Member Author

commented Dec 12, 2018

(Found while investigating #27868.)


This comment has been minimized.

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.