Skip to content

Commit 0cadf40

Browse files
author
Jay Conrod
committed
cmd/go: tweak wording of module path mismatch error message
Changes "was loaded as" to "was required as". This is slightly more precise, since it hints at a requirement edge in the module version graph. Updates #28489 Change-Id: I636268c33f1ea9858c214fe275f271538186ed6d Reviewed-on: https://go-review.googlesource.com/c/go/+/186377 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 2bcbe6a commit 0cadf40

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: src/cmd/go/internal/modload/load.go

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

Diff for: src/cmd/go/testdata/script/mod_load_badchain.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,27 @@ func Test(t *testing.T) {}
5959
go get: example.com/badchain/[email protected] updating to
6060
example.com/badchain/[email protected]: parsing go.mod:
6161
module declares its path as: example.com/badchain/c
62-
but was loaded as: example.com/badchain/wrong
62+
but was required as: example.com/badchain/wrong
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:
6767
module declares its path as: example.com/badchain/c
68-
but was loaded as: example.com/badchain/wrong
68+
but was required as: example.com/badchain/wrong
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:
7373
module declares its path as: example.com/badchain/c
74-
but was loaded as: example.com/badchain/wrong
74+
but was required as: example.com/badchain/wrong
7575
-- list-missing-expected --
7676
go: m/use imports
7777
example.com/badchain/c: example.com/badchain/[email protected]: parsing go.mod:
7878
module declares its path as: example.com/badchain/c
79-
but was loaded as: example.com/badchain/wrong
79+
but was required as: example.com/badchain/wrong
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:
8484
module declares its path as: example.com/badchain/c
85-
but was loaded as: example.com/badchain/wrong
85+
but was required as: example.com/badchain/wrong

0 commit comments

Comments
 (0)