From 27a9b1bbecc0b1aa02d88128ef36904e6f56ec43 Mon Sep 17 00:00:00 2001 From: as Date: Wed, 1 Aug 2018 18:38:46 +0000 Subject: [PATCH] cmd/go: avoid panic on 'go mod' without arguments Fixes #26738 Change-Id: Icede3f59acb5b0e388660653cefc24a195b5d43b GitHub-Last-Rev: 9989b74c12e94163c1f18859485a4ac0d74c5453 GitHub-Pull-Request: golang/go#26739 Reviewed-on: https://go-review.googlesource.com/127160 Reviewed-by: Brad Fitzpatrick Reviewed-by: Bryan C. Mills --- src/cmd/go/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go index 25dfe8ffa4..59d367edaa 100644 --- a/src/cmd/go/main.go +++ b/src/cmd/go/main.go @@ -193,6 +193,8 @@ BigCmdLoop: args = args[1:] if len(args) == 0 { help.PrintUsage(os.Stderr, bigCmd) + base.SetExitStatus(2) + base.Exit() } if args[0] == "help" { // Accept 'go mod help' and 'go mod help foo' for 'go help mod' and 'go help mod foo'.