]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add modload.NeedRoot mode for commands that need module root
authorJay Conrod <jayconrod@google.com>
Fri, 11 Sep 2020 17:30:43 +0000 (13:30 -0400)
committerJay Conrod <jayconrod@google.com>
Tue, 15 Sep 2020 12:46:25 +0000 (12:46 +0000)
commit03875bd9bc112d25a4496f7ff22888f23a26baea
tree6f9fc4493cb0b775dabd1affa30d6e4209b153c3
parente3063636124d0e5b2d0fad7912a9c6810629f486
cmd/go: add modload.NeedRoot mode for commands that need module root

This makes error reporting a bit more consistent for 'go mod'
subcommands. Most of these commands only work in module mode when a
go.mod file is present.

Setting modload.ForceUseModules reports an error when GO111MODULE=off.

Setting modload.RootMode to modload.NeedRoot reports an error when no
go.mod file is present.

Change-Id: I1daa8d2971cb8658e0c804765839d903734a412e
Reviewed-on: https://go-review.googlesource.com/c/go/+/254369
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/modcmd/download.go
src/cmd/go/internal/modcmd/graph.go
src/cmd/go/internal/modcmd/init.go
src/cmd/go/internal/modcmd/tidy.go
src/cmd/go/internal/modcmd/vendor.go
src/cmd/go/internal/modcmd/verify.go
src/cmd/go/internal/modcmd/why.go
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_off.txt
src/cmd/go/testdata/script/mod_off_init.txt