Skip to content

Commit 8f5353f

Browse files
author
Bryan C. Mills
committed
cmd/go/internal/modload: fix swapped paths in error message
Updates #33879 Change-Id: Ifc91490b1cb791fdf5ffe69ef81c0ec0e6cbecc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/191997 Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Alexander Rakoczy <[email protected]>
1 parent c302785 commit 8f5353f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/cmd/go/internal/modload/load.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) {
11401140
if mpath := f.Module.Mod.Path; mpath != origPath && mpath != mod.Path {
11411141
return nil, module.VersionError(mod, fmt.Errorf(`parsing go.mod:
11421142
module declares its path as: %s
1143-
but was required as: %s`, mod.Path, mpath))
1143+
but was required as: %s`, mpath, mod.Path))
11441144
}
11451145
if f.Go != nil {
11461146
r.versions.LoadOrStore(mod, f.Go.Version)

src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
example.com/badchain/c v1.1.0
22

33
-- .mod --
4-
module example.com/badchain/wrong
4+
module badchain.example.com/c
55
-- .info --
66
{"Version":"v1.1.0"}
77
-- c.go --

src/cmd/go/testdata/script/mod_load_badchain.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,28 @@ func Test(t *testing.T) {}
5858
-- update-main-expected --
5959
go get: example.com/badchain/[email protected] updating to
6060
example.com/badchain/[email protected]: parsing go.mod:
61-
module declares its path as: example.com/badchain/c
62-
but was required as: example.com/badchain/wrong
61+
module declares its path as: badchain.example.com/c
62+
but was required as: example.com/badchain/c
6363
-- update-a-expected --
6464
go get: example.com/badchain/[email protected] requires
6565
example.com/badchain/[email protected] requires
6666
example.com/badchain/[email protected]: parsing go.mod:
67-
module declares its path as: example.com/badchain/c
68-
but was required as: example.com/badchain/wrong
67+
module declares its path as: badchain.example.com/c
68+
but was required as: example.com/badchain/c
6969
-- list-expected --
7070
go: example.com/badchain/[email protected] requires
7171
example.com/badchain/[email protected] requires
7272
example.com/badchain/[email protected]: parsing go.mod:
73-
module declares its path as: example.com/badchain/c
74-
but was required as: example.com/badchain/wrong
73+
module declares its path as: badchain.example.com/c
74+
but was required as: example.com/badchain/c
7575
-- list-missing-expected --
7676
go: m/use imports
7777
example.com/badchain/c: example.com/badchain/[email protected]: parsing go.mod:
78-
module declares its path as: example.com/badchain/c
79-
but was required as: example.com/badchain/wrong
78+
module declares its path as: badchain.example.com/c
79+
but was required as: example.com/badchain/c
8080
-- list-missing-test-expected --
8181
go: m/testuse tested by
8282
m/testuse.test imports
8383
example.com/badchain/c: example.com/badchain/[email protected]: parsing go.mod:
84-
module declares its path as: example.com/badchain/c
85-
but was required as: example.com/badchain/wrong
84+
module declares its path as: badchain.example.com/c
85+
but was required as: example.com/badchain/c

0 commit comments

Comments
 (0)