]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: reject list when -find and -export are used together
authorRenKanai <rk2904powr@gmail.com>
Sun, 27 Mar 2022 13:06:22 +0000 (22:06 +0900)
committerGopher Robot <gobot@golang.org>
Mon, 27 Feb 2023 21:23:29 +0000 (21:23 +0000)
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>
src/cmd/go/alldocs.go
src/cmd/go/internal/list/list.go

index 6b91b53347a61a9ca034437e76b18c90984e5042..0f8433efca71c8932e40b7f6527de9f3be2e30a5 100644 (file)
 //
 // 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
index 7f3090872b148626efc74ae897fed15fb85c7771..259fa2c857faf72900dc7528451a402e0b329fd2 100644 (file)
@@ -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,