]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add -modfile and -modcacherw to go tool
authorConrad Irwin <conrad.irwin@gmail.com>
Sun, 1 Dec 2024 06:22:49 +0000 (23:22 -0700)
committerMichael Matloob <matloob@golang.org>
Fri, 6 Dec 2024 18:28:57 +0000 (18:28 +0000)
commitec7817e385a0e8f0bcd6c8082f465d81852ab500
tree2152f3a7b029939cc754ec1fdd5dc84cee0915e6
parentd3d4e7b0d10d5587093b769ed600bd3b0a3fd9c1
cmd/go: add -modfile and -modcacherw to go tool

When adding support for module tools, we added the ability for `go tool`
to edit the module cache. For users with `GOFLAGS=-modcacherw` this
could have led to a situation where some of the files in the mod cache
were unexpectedly not deletable.

We also allow -modfile so that people can select which module they are
working in when looking for tools.

We still do not support arbitrary build flags for tools with `go tool`.
If you want those, use `go run` or `go build`, etc. instead.

Updates #48429

Change-Id: Ic3c56bb8b6ba46114196465ca6ee2dcb08b9dcc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/632575
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/cmd/go/internal/tool/tool.go
src/cmd/go/testdata/script/mod_cache_rw.txt
src/cmd/go/testdata/script/modfile_flag.txt