diff options
author | Zeke Lu <lvzecai@gmail.com> | 2023-05-09 23:25:50 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-05-12 17:42:47 +0000 |
commit | d6cc77fa2532799609cff369af65378a83ab9030 (patch) | |
tree | d63a25f0c7e00effdd07a7a0f766521d07f824ec /src/cmd/go/internal/modload/load.go | |
parent | 9eceffdf12dc4497ee162c005d5e14bb509797b9 (diff) | |
download | go-d6cc77fa2532799609cff369af65378a83ab9030.tar.gz go-d6cc77fa2532799609cff369af65378a83ab9030.zip |
cmd/go/internal/modload: reject the -modfile flag in workspace mode
Currently, in workspace mode, the -modfile flag affects all the modules
listed in the go.work file. This is not desirable most of the time. And
when it results in an error, the error message does not help.
For example, when there are more than one modules listed in the go.work
file, running "go list -m -modfile=path/to/go.mod" gives this error:
go: module example.com/foo appears multiple times in workspace
This change reject -modfile flag explicitly with this error message:
go: -modfile cannot be used in workspace mode
While at here, correct some typos in the modload package.
Fixes #59996.
Change-Id: Iff4cd9f3974ea359889dd713a747b6932cf42dfd
GitHub-Last-Rev: 7dbc9c3f2f9bfe8acab088eb3266a08d8ec1ba16
GitHub-Pull-Request: golang/go#60033
Reviewed-on: https://go-review.googlesource.com/c/go/+/493315
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/load.go')
-rw-r--r-- | src/cmd/go/internal/modload/load.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go index 9b6a81dd7c5..1251b56c866 100644 --- a/src/cmd/go/internal/modload/load.go +++ b/src/cmd/go/internal/modload/load.go @@ -149,7 +149,7 @@ type PackageOpts struct { Tags map[string]bool // Tidy, if true, requests that the build list and go.sum file be reduced to - // the minimial dependencies needed to reproducibly reload the requested + // the minimal dependencies needed to reproducibly reload the requested // packages. Tidy bool @@ -2006,7 +2006,7 @@ func (ld *loader) checkTidyCompatibility(ctx context.Context, rs *Requirements) if pkg.isTest() { // We already did (or will) report an error for the package itself, - // so don't report a duplicate (and more vebose) error for its test. + // so don't report a duplicate (and more verbose) error for its test. if _, ok := mismatches[pkg.testOf]; !ok { base.Fatalf("go: internal error: mismatch recorded for test %s, but not its non-test package", pkg.path) } |