From: Jay Conrod Date: Fri, 8 Mar 2019 20:25:11 +0000 (-0500) Subject: cmd/go: improve wording of 'go mod init' error X-Git-Tag: go1.13beta1~1128 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=91c9ed084096b105858ab13a3c26925d82592d56;p=gostls13.git cmd/go: improve wording of 'go mod init' error When 'go mod init' is run without a module path, it tries to infer a module path, based on the current directory (if in GOPATH), import comments, and vendor configuration files. It's common for this command to fail the first time a user tries to create a module in a new project outside GOPATH. This change improves the wording of the error message to hint that the user should specify a module path. Fixes #30678 Change-Id: Iec0352e919dbc8b426ab71eed236fad3929ec671 Reviewed-on: https://go-review.googlesource.com/c/go/+/166319 Reviewed-by: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 20f7389f55..940f0a8e45 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -565,7 +565,7 @@ func findModulePath(dir string) (string, error) { return "github.com/" + string(m[1]), nil } - return "", fmt.Errorf("cannot determine module path for source directory %s (outside GOPATH, no import comments)", dir) + return "", fmt.Errorf("cannot determine module path for source directory %s (outside GOPATH, module path not specified)", dir) } var (