golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.58k stars 17.48k forks source link

cmd/go: add option to ignore local replace/exclude directives #24666

Open rsc opened 6 years ago

rsc commented 6 years ago

If you have a go.mod with replace/exclude directives, those are used when building that module as the top-level target but not when used as a dependency. It might be helpful to have a command-line build flag that means "ignore those even in the top-level module" so that you can test more easily in the configuration users will see.

gopherbot commented 6 years ago

Change https://golang.org/cl/126696 mentions this issue: cmd/go: replace -getmode with -mod, $GOPROXY

thepudds commented 6 years ago

Note that change https://golang.org/cl/126696 states 'Fixes #24666' (this issue), which is presumably what triggered gopherbot to close this issue, but as far I as can see from quick look it looks like the piece of the CL related to this particular issue was in the first patch for the change but then (purposefully) dropped during the review process.

Not sure if the 'Fixes #24666' in the CL was left purposefully or accidentally, but at least wanted to add this comment here indicating that -mod=release does not seem to exist on master.

Description from the original patch:

If invoked with -mod=release, the go command ignores replace and exclude directives in go.mod, essentially viewing the module as it would when released and used as a dependency of another module.