...
1[short] skip
2env GO111MODULE=on
3
4# Download everything to avoid "finding" messages in stderr later.
5cp go.mod.orig go.mod
6go mod download
7go mod download example.com@v1.0.0
8go mod download example.com/badchain/a@v1.1.0
9go mod download example.com/badchain/b@v1.1.0
10go mod download example.com/badchain/c@v1.1.0
11
12# Try to update example.com/badchain/a (and its dependencies).
13! go get example.com/badchain/a
14cmp stderr update-a-expected
15cmp go.mod go.mod.orig
16
17# Try to update the main module. This updates everything, including
18# modules that aren't direct requirements, so the error stack is shorter.
19go get -u ./...
20cmp stderr update-main-expected
21cmp go.mod go.mod.withc
22
23# Update manually. Listing modules should produce an error.
24cp go.mod.orig go.mod
25go mod edit -require=example.com/badchain/a@v1.1.0
26! go list -m all
27cmp stderr list-expected
28
29# Try listing a package that imports a package
30# in a module without a requirement.
31go mod edit -droprequire example.com/badchain/a
32! go list -mod=mod m/use
33cmp stderr list-missing-expected
34
35! go list -mod=mod -test m/testuse
36cmp stderr list-missing-test-expected
37
38-- go.mod.orig --
39module m
40
41go 1.13
42
43require example.com/badchain/a v1.0.0
44-- go.mod.withc --
45module m
46
47go 1.13
48
49require (
50 example.com/badchain/a v1.0.0
51 example.com/badchain/c v1.0.0
52)
53-- go.sum --
54example.com/badchain/a v1.0.0 h1:iJDLiHLmpQgr9Zrv+44UqywAE2IG6WkHnH4uG08vf+s=
55example.com/badchain/a v1.0.0/go.mod h1:6/gnCYHdVrs6mUgatUYUSbuHxEY+/yWedmTggLz23EI=
56example.com/badchain/a v1.1.0 h1:cPxQpsOjaIrn05yDfl4dFFgGSbjYmytLqtIIBfTsEqA=
57example.com/badchain/a v1.1.0/go.mod h1:T15b2BEK+RY7h7Lr2dgS38p1pgH5/t7Kf5nQXBlcW/A=
58example.com/badchain/b v1.0.0 h1:kjDVlBxpjQavYxHE7ECCyyXhfwsfhWIqvghfRgPktSA=
59example.com/badchain/b v1.0.0/go.mod h1:sYsH934pMc3/A2vQZh019qrWmp4+k87l3O0VFUYqL+I=
60example.com/badchain/b v1.1.0 h1:iEALV+DRN62FArnYylBR4YwCALn/hCdITvhdagHa0L4=
61example.com/badchain/b v1.1.0/go.mod h1:mlCgKO7lRZ+ijwMFIBFRPCGt5r5oqCcHdhSSE0VL4uY=
62example.com/badchain/c v1.0.0 h1:lOeUHQKR7SboSH7Bj6eIDWoNHaDQXI0T2GfaH2x9fNA=
63example.com/badchain/c v1.0.0/go.mod h1:4U3gzno17SaQ2koSVNxITu9r60CeLSgye9y4/5LnfOE=
64example.com/badchain/c v1.1.0 h1:VtTg1g7fOutWKHQf+ag04KLRpdMGSfQ9s9tagVtGW14=
65example.com/badchain/c v1.1.0/go.mod h1:tyoJj5qh+qtb48sflwdVvk4R+OjPQEY2UJOoibsVLPk=
66-- use/use.go --
67package use
68
69import _ "example.com/badchain/c"
70-- testuse/testuse.go --
71package testuse
72-- testuse/testuse_test.go --
73package testuse
74
75import (
76 "testing"
77 _ "example.com/badchain/c"
78)
79
80func Test(t *testing.T) {}
81-- update-main-expected --
82go: example.com/badchain/c@v1.1.0: parsing go.mod:
83 module declares its path as: badchain.example.com/c
84 but was required as: example.com/badchain/c
85 restoring example.com/badchain/c@v1.0.0
86-- update-a-expected --
87go: example.com/badchain/a@upgrade (v1.1.0) indirectly requires example.com/badchain/c@v1.1.0: parsing go.mod:
88 module declares its path as: badchain.example.com/c
89 but was required as: example.com/badchain/c
90-- list-expected --
91go: example.com/badchain/a@v1.1.0 requires
92 example.com/badchain/b@v1.1.0 requires
93 example.com/badchain/c@v1.1.0: parsing go.mod:
94 module declares its path as: badchain.example.com/c
95 but was required as: example.com/badchain/c
96-- list-missing-expected --
97go: finding module for package example.com/badchain/c
98go: found example.com/badchain/c in example.com/badchain/c v1.1.0
99go: m/use imports
100 example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
101 module declares its path as: badchain.example.com/c
102 but was required as: example.com/badchain/c
103-- list-missing-test-expected --
104go: finding module for package example.com/badchain/c
105go: found example.com/badchain/c in example.com/badchain/c v1.1.0
106go: m/testuse tested by
107 m/testuse.test imports
108 example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod:
109 module declares its path as: badchain.example.com/c
110 but was required as: example.com/badchain/c
View as plain text