mirror of
https://github.com/golang/go
synced 2024-11-23 21:00:06 -07:00
cmd/go: reject list when -find and -export are used together
Fixes #51952. Change-Id: If2cfc41d65373ca38cfb7b0396be8988d444eb5e Reviewed-on: https://go-review.googlesource.com/c/go/+/396074 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
83907206de
commit
0ff91e03db
@ -925,6 +925,8 @@
|
||||
//
|
||||
// The -find flag causes list to identify the named packages but not
|
||||
// resolve their dependencies: the Imports and Deps lists will be empty.
|
||||
// With the -find flag, the -deps, -test and -export commands cannot be
|
||||
// used.
|
||||
//
|
||||
// The -test flag causes list to report not only the named packages
|
||||
// but also their test binaries (for packages with tests), to convey to
|
||||
|
@ -193,6 +193,8 @@ and the BuildID field to the build ID of the compiled package.
|
||||
|
||||
The -find flag causes list to identify the named packages but not
|
||||
resolve their dependencies: the Imports and Deps lists will be empty.
|
||||
With the -find flag, the -deps, -test and -export commands cannot be
|
||||
used.
|
||||
|
||||
The -test flag causes list to report not only the named packages
|
||||
but also their test binaries (for packages with tests), to convey to
|
||||
@ -592,6 +594,9 @@ func runList(ctx context.Context, cmd *base.Command, args []string) {
|
||||
if *listFind && *listTest {
|
||||
base.Fatalf("go list -test cannot be used with -find")
|
||||
}
|
||||
if *listFind && *listExport {
|
||||
base.Fatalf("go list -export cannot be used with -find")
|
||||
}
|
||||
|
||||
pkgOpts := load.PackageOpts{
|
||||
IgnoreImports: *listFind,
|
||||
|
Loading…
Reference in New Issue
Block a user