...
1# Test mismatched sums in go.sum files
2
3! go run ./a
4cmpenv stderr want-error
5
6-- want-error --
7verifying rsc.io/sampler@v1.3.0/go.mod: checksum mismatch
8 downloaded: h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
9 $WORK${/}gopath${/}src${/}a${/}go.sum: h1:U1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
10
11SECURITY ERROR
12This download does NOT match an earlier download recorded in go.sum.
13The bits may have been replaced on the origin server, or an attacker may
14have intercepted the download attempt.
15
16For more information, see 'go help module-auth'.
17-- go.work --
18go 1.18
19
20use ./a
21use ./b
22-- a/go.mod --
23go 1.18
24
25module example.com/hi
26
27require "rsc.io/quote" v1.5.2
28-- a/go.sum --
29rsc.io/sampler v1.3.0 h1:HLGR/BgEtI3r0uymSP/nl2uPLsUnNJX8toRyhfpBTII=
30rsc.io/sampler v1.3.0/go.mod h1:U1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
31-- a/main.go --
32package main
33
34import (
35 "fmt"
36 "rsc.io/quote"
37)
38
39func main() {
40 fmt.Println(quote.Hello())
41}
42-- b/go.mod --
43go 1.18
44
45module example.com/hi2
46
47require "rsc.io/quote" v1.5.2
48-- b/go.sum --
49rsc.io/sampler v1.3.0 h1:HLGR/BgEtI3r0uymSP/nl2uPLsUnNJX8toRyhfpBTII=
50rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
51-- b/main.go --
52package main
53
54import (
55 "fmt"
56 "rsc.io/quote"
57)
58
59func main() {
60 fmt.Println(quote.Hello())
61}
View as plain text