aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_update_unrelated_sum.txt
blob: 0093c0eda0c8270eabe147901828f994f88122af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Check that 'go get' adds sums for updated modules if we had sums before,
# even if we didn't load packages from them.
# Verifies #44129.

env fmt='{{.ImportPath}}: {{if .Error}}{{.Error.Err}}{{else}}ok{{end}}'

# Control case: before upgrading, we have the sums we need.
# go list -deps -e -f $fmt .
# stdout '^rsc.io/quote: ok$'
# ! stdout rsc.io/sampler  # not imported by quote in this version
cp go.mod.orig go.mod
cp go.sum.orig go.sum
go mod tidy
cmp go.mod.orig go.mod
cmp go.sum.orig go.sum


# Upgrade a module. This also upgrades rsc.io/quote, and though we didn't load
# a package from it, we had the sum for its old version, so we need the
# sum for the new version, too.
go get -d example.com/upgrade@v0.0.2
grep '^rsc.io/quote v1.5.2 ' go.sum

# The upgrade still breaks the build because the new version of quote imports
# rsc.io/sampler, and we don't have its zip sum.
go list -deps -e -f $fmt
stdout 'rsc.io/quote: ok'
stdout 'rsc.io/sampler: missing go.sum entry for module providing package rsc.io/sampler'
cp go.mod.orig go.mod
cp go.sum.orig go.sum


# Replace the old version with a directory before upgrading.
# We didn't need a sum for it before (even though we had one), so we won't
# fetch a new sum.
go mod edit -replace rsc.io/quote@v1.0.0=./dummy
go get -d example.com/upgrade@v0.0.2
! grep '^rsc.io/quote v1.5.2 ' go.sum
cp go.mod.orig go.mod
cp go.sum.orig go.sum


# Replace the new version with a directory before upgrading.
# We can't get a sum for a directory.
go mod edit -replace rsc.io/quote@v1.5.2=./dummy
go get -d example.com/upgrade@v0.0.2
! grep '^rsc.io/quote v1.5.2 ' go.sum
cp go.mod.orig go.mod
cp go.sum.orig go.sum


# Replace the new version with a different version.
# We should get a sum for that version.
go mod edit -replace rsc.io/quote@v1.5.2=rsc.io/quote@v1.5.1
go get -d example.com/upgrade@v0.0.2
! grep '^rsc.io/quote v1.5.2 ' go.sum
grep '^rsc.io/quote v1.5.1 ' go.sum
cp go.mod.orig go.mod
cp go.sum.orig go.sum


# Delete the new version's zip (but not mod) from the cache and go offline.
# 'go get' should fail when fetching the zip.
rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
env GOPROXY=off
! go get -d example.com/upgrade@v0.0.2
stderr '^go: upgraded rsc.io/quote v1.0.0 => v1.5.2: error finding sum for rsc.io/quote@v1.5.2: module lookup disabled by GOPROXY=off$'

-- go.mod.orig --
module m

go 1.16

require (
	example.com/upgrade v0.0.1
	rsc.io/quote v1.0.0
)

replace (
	example.com/upgrade v0.0.1 => ./upgrade1
	example.com/upgrade v0.0.2 => ./upgrade2
)
-- go.sum.orig --
rsc.io/quote v1.0.0 h1:kQ3IZQzPTiDJxSZI98YaWgxFEhlNdYASHvh+MplbViw=
rsc.io/quote v1.0.0/go.mod h1:v83Ri/njykPcgJltBc/gEkJTmjTsNgtO1Y7vyIK1CQA=
-- go.sum.want --
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
rsc.io/quote v1.0.0 h1:kQ3IZQzPTiDJxSZI98YaWgxFEhlNdYASHvh+MplbViw=
rsc.io/quote v1.0.0/go.mod h1:v83Ri/njykPcgJltBc/gEkJTmjTsNgtO1Y7vyIK1CQA=
rsc.io/quote v1.5.2 h1:3fEykkD9k7lYzXqCYrwGAf7iNhbk4yCjHmKBN9td4L0=
rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
-- use.go --
package use

import (
	_ "example.com/upgrade"
	_ "rsc.io/quote"
)
-- upgrade1/go.mod --
module example.com/upgrade

go 1.16
-- upgrade1/upgrade.go --
package upgrade
-- upgrade2/go.mod --
module example.com/upgrade

go 1.16

require rsc.io/quote v1.5.2 // indirect
-- upgrade2/upgrade.go --
package upgrade
-- dummy/go.mod --
module rsc.io/quote

go 1.16
-- dummy/quote.go --
package quote