aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/list/list.go
diff options
context:
space:
mode:
authorAyan George <ayan@ayan.net>2021-03-02 17:44:22 -0500
committerBryan C. Mills <bcmills@google.com>2021-03-25 13:57:08 +0000
commit9f4d5c94b0cafc4d888b7f02e4ff12c2ff39eedc (patch)
tree9fcc46d9a7e05be5dc158b90b5f83f62809e1647 /src/cmd/go/internal/list/list.go
parent402d784b8fc0a7914955eb168ea288338e2025ff (diff)
downloadgo-9f4d5c94b0cafc4d888b7f02e4ff12c2ff39eedc.tar.gz
go-9f4d5c94b0cafc4d888b7f02e4ff12c2ff39eedc.zip
cmd/go: emit error when listing with -f and -json
Fixes #44738 Change-Id: Ie57ddcbe87408c9644313ec2a9ea347b4d6de76b Reviewed-on: https://go-review.googlesource.com/c/go/+/298029 Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/list/list.go')
-rw-r--r--src/cmd/go/internal/list/list.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/go/internal/list/list.go b/src/cmd/go/internal/list/list.go
index bb48d2d2ea..1e1c6495bf 100644
--- a/src/cmd/go/internal/list/list.go
+++ b/src/cmd/go/internal/list/list.go
@@ -335,6 +335,10 @@ var (
var nl = []byte{'\n'}
func runList(ctx context.Context, cmd *base.Command, args []string) {
+ if *listFmt != "" && *listJson == true {
+ base.Fatalf("go list -f cannot be used with -json")
+ }
+
load.ModResolveTests = *listTest
work.BuildInit()
out := newTrackingWriter(os.Stdout)