cmd/go: avoid panic on 'go mod' without arguments

Fixes #26738

Change-Id: Icede3f59acb5b0e388660653cefc24a195b5d43b
GitHub-Last-Rev: 9989b74c12
GitHub-Pull-Request: golang/go#26739
Reviewed-on: https://go-review.googlesource.com/127160
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
as 2018-08-01 18:38:46 +00:00 committed by Bryan C. Mills
parent acd30e9a82
commit 27a9b1bbec

View file

@ -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'.