]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: clarify error from 'go install' when arguments have mismatched versions and...
authoruji <ujiprog@gmail.com>
Sat, 26 Feb 2022 13:58:54 +0000 (13:58 +0000)
committerBryan Mills <bcmills@google.com>
Fri, 4 Mar 2022 21:06:05 +0000 (21:06 +0000)
Fixes #51196.

Change-Id: I0ee4d8234f11e4f3b71b81546518647e07fafd7d
GitHub-Last-Rev: 8fd1a77adff982dd00385c5b25a4e0cdf3e2e220
GitHub-Pull-Request: golang/go#51373
Reviewed-on: https://go-review.googlesource.com/c/go/+/388154
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/go/internal/load/pkg.go
src/cmd/go/testdata/script/mod_install_pkg_version.txt

index d68f43a7c9846849937cc23954f49d4a8149f973..fdc00f95dca4a6ac229573f379f52a6eba763efd 100644 (file)
@@ -3001,7 +3001,7 @@ func PackagesAndErrorsOutsideModule(ctx context.Context, opts PackageOpts, args
        patterns := make([]string, len(args))
        for i, arg := range args {
                if !strings.HasSuffix(arg, "@"+version) {
-                       return nil, fmt.Errorf("%s: all arguments must have the same version (@%s)", arg, version)
+                       return nil, fmt.Errorf("%s: all arguments must refer to packages in the same module at the same version (@%s)", arg, version)
                }
                p := arg[:len(arg)-len(version)-1]
                switch {
index 14153b8e9ec60903fba9486f72b516c2500db76b..e3f59fc15289d9999e3c8a0f1c9057ecfc14eb2a 100644 (file)
@@ -106,7 +106,7 @@ stdout '^example.com/cmd v1.0.0$'
 env GO111MODULE=auto
 
 ! go install example.com/cmd/a@v1.0.0 example.com/cmd/b@latest
-stderr '^go: example.com/cmd/b@latest: all arguments must have the same version \(@v1.0.0\)$'
+stderr '^go: example.com/cmd/b@latest: all arguments must refer to packages in the same module at the same version \(@v1.0.0\)$'
 
 
 # 'go install pkg@version' should report an error if the arguments are in