aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-08-27 15:36:21 -0400
committerBryan C. Mills <bcmills@google.com>2019-08-27 21:14:34 +0000
commit1ae4e73c11bab9f8c310f2d74f795fa00198f914 (patch)
tree71b8705acb70595d3ada0f4b39460cd895d15a5a
parent2e3989e04effe63de165cd81df49284dc12b1bf8 (diff)
downloadgo-1ae4e73c11bab9f8c310f2d74f795fa00198f914.tar.gz
go-1ae4e73c11bab9f8c310f2d74f795fa00198f914.zip
[release-branch.go1.13] cmd/go/internal/modload: fix swapped paths in error message
Cherry-picked from CL 191997. Updates #33879 Fixes #33885 Change-Id: Ifc91490b1cb791fdf5ffe69ef81c0ec0e6cbecc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/191997 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Alexander Rakoczy <alex@golang.org> (cherry picked from commit 8f5353fd1c0598bf5c92d67ffe8cfa1424115694) Reviewed-on: https://go-review.googlesource.com/c/go/+/191972 TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/cmd/go/internal/modload/load.go2
-rw-r--r--src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt2
-rw-r--r--src/cmd/go/testdata/script/mod_load_badchain.txt20
3 files changed, 12 insertions, 12 deletions
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index 52b371e5a9..b50a084166 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -1140,7 +1140,7 @@ func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) {
if mpath := f.Module.Mod.Path; mpath != origPath && mpath != mod.Path {
return nil, module.VersionError(mod, fmt.Errorf(`parsing go.mod:
module declares its path as: %s
- but was required as: %s`, mod.Path, mpath))
+ but was required as: %s`, mpath, mod.Path))
}
if f.Go != nil {
r.versions.LoadOrStore(mod, f.Go.Version)
diff --git a/src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt b/src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt
index da19ebd9ec..36bc2c6726 100644
--- a/src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt
+++ b/src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt
@@ -1,7 +1,7 @@
example.com/badchain/c v1.1.0
-- .mod --
-module example.com/badchain/wrong
+module badchain.example.com/c
-- .info --
{"Version":"v1.1.0"}
-- c.go --
diff --git a/src/cmd/go/testdata/script/mod_load_badchain.txt b/src/cmd/go/testdata/script/mod_load_badchain.txt
index 559f411593..b97a2e6eab 100644
--- a/src/cmd/go/testdata/script/mod_load_badchain.txt
+++ b/src/cmd/go/testdata/script/mod_load_badchain.txt
@@ -58,28 +58,28 @@ func Test(t *testing.T) {}
-- update-main-expected --
go get: example.com/badchain/c@v1.0.0 updating to
example.com/badchain/c@v1.1.0: parsing go.mod:
- module declares its path as: example.com/badchain/c
- but was required as: example.com/badchain/wrong
+ module declares its path as: badchain.example.com/c
+ but was required as: example.com/badchain/c
-- update-a-expected --
go get: example.com/badchain/a@v1.1.0 requires
example.com/badchain/b@v1.1.0 requires
example.com/badchain/c@v1.1.0: parsing go.mod:
- module declares its path as: example.com/badchain/c
- but was required as: example.com/badchain/wrong
+ module declares its path as: badchain.example.com/c
+ but was required as: example.com/badchain/c
-- list-expected --
go: example.com/badchain/a@v1.1.0 requires
example.com/badchain/b@v1.1.0 requires
example.com/badchain/c@v1.1.0: parsing go.mod:
- module declares its path as: example.com/badchain/c
- but was required as: example.com/badchain/wrong
+ module declares its path as: badchain.example.com/c
+ but was required as: example.com/badchain/c
-- list-missing-expected --
go: m/use imports
example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
- module declares its path as: example.com/badchain/c
- but was required as: example.com/badchain/wrong
+ module declares its path as: badchain.example.com/c
+ but was required as: example.com/badchain/c
-- list-missing-test-expected --
go: m/testuse tested by
m/testuse.test imports
example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
- module declares its path as: example.com/badchain/c
- but was required as: example.com/badchain/wrong
+ module declares its path as: badchain.example.com/c
+ but was required as: example.com/badchain/c