diff options
author | Jay Conrod <jayconrod@google.com> | 2021-01-07 11:14:06 -0500 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2021-01-08 20:19:51 +0000 |
commit | 6192b9875128c5f53a69b959d5a1abf0f10ae93f (patch) | |
tree | c39777eb78c5c3309578cd8bd7758989fd9901ac /src/cmd/go/internal/load/pkg.go | |
parent | 25886cf4bd28be373afb80a4c068a785b43bdddf (diff) | |
download | go-6192b9875128c5f53a69b959d5a1abf0f10ae93f.tar.gz go-6192b9875128c5f53a69b959d5a1abf0f10ae93f.zip |
cmd/go: make hints in error messages more consistent
* All commands the user can run to fix the problem now appear alone on
a separate line after a tab.
* Removed -d from 'go get' commands.
* Replaced 'go mod tidy' with 'go mod download $modpath' when a
package might be provided by a module missing a sum.
* Errors about 'path@version' syntax are more explicit.
Fixes #29415
Fixes #42087
Fixes #43430
Fixes #43523
Change-Id: I4427c2c4506a727a2c727d652fd2d506bb134d3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/282121
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/load/pkg.go')
-rw-r--r-- | src/cmd/go/internal/load/pkg.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index 855f9698a2..cffc8fcefa 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -769,11 +769,7 @@ func loadPackageData(path, parentPath, parentDir, parentRoot string, parentIsStd } if strings.Contains(path, "@") { - if cfg.ModulesEnabled { - return nil, false, errors.New("can only use path@version syntax with 'go get'") - } else { - return nil, false, errors.New("cannot use path@version syntax in GOPATH mode") - } + return nil, false, errors.New("can only use path@version syntax with 'go get' and 'go install' in module-aware mode") } // Determine canonical package path and directory. |