github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_verify.txt (about) 1 env GO111MODULE=on 2 [short] skip 3 4 # With good go.sum, verify succeeds by avoiding download. 5 cp go.sum.good go.sum 6 go mod verify 7 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip 8 9 # With bad go.sum, verify succeeds by avoiding download. 10 cp go.sum.bad go.sum 11 go mod verify 12 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip 13 14 # With bad go.sum, sync (which must download) fails. 15 # Even if the bad sum is in the old legacy go.modverify file. 16 rm go.sum 17 cp go.sum.bad go.modverify 18 ! go mod tidy 19 stderr 'checksum mismatch' 20 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip 21 22 # With good go.sum, sync works (and moves go.modverify to go.sum). 23 rm go.sum 24 cp go.sum.good go.modverify 25 go mod tidy 26 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip 27 exists $GOPATH/pkg/mod/rsc.io/quote@v1.1.0/quote.go 28 ! exists go.modverify 29 30 # go.sum should have the new checksum for go.mod 31 grep '^rsc.io/quote v1.1.0/go.mod ' go.sum 32 33 # verify should work 34 go mod verify 35 36 # basic loading of module graph should detect incorrect go.mod files. 37 go mod graph 38 cp go.sum.bad2 go.sum 39 ! go mod graph 40 stderr 'go.mod: checksum mismatch' 41 42 # go.sum should be created and updated automatically. 43 rm go.sum 44 go mod graph 45 exists go.sum 46 grep '^rsc.io/quote v1.1.0/go.mod ' go.sum 47 ! grep '^rsc.io/quote v1.1.0 ' go.sum 48 49 go mod tidy 50 grep '^rsc.io/quote v1.1.0/go.mod ' go.sum 51 grep '^rsc.io/quote v1.1.0 ' go.sum 52 53 # sync should ignore missing ziphash; verify should not 54 rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.ziphash 55 go mod tidy 56 ! go mod verify 57 58 # Packages below module root should not be mentioned in go.sum. 59 rm go.sum 60 go mod edit -droprequire rsc.io/quote 61 go list rsc.io/quote/buggy # re-resolves import path and updates go.mod 62 grep '^rsc.io/quote v1.5.2/go.mod ' go.sum 63 ! grep buggy go.sum 64 65 # non-existent packages below module root should not be mentioned in go.sum 66 go mod edit -droprequire rsc.io/quote 67 ! go list rsc.io/quote/morebuggy 68 grep '^rsc.io/quote v1.5.2/go.mod ' go.sum 69 ! grep buggy go.sum 70 71 -- go.mod -- 72 module x 73 require rsc.io/quote v1.1.0 74 75 -- x.go -- 76 package x 77 import _ "rsc.io/quote" 78 79 -- go.sum.good -- 80 rsc.io/quote v1.1.0 h1:a3YaZoizPtXyv6ZsJ74oo2L4/bwOSTKMY7MAyo4O/0c= 81 82 -- go.sum.bad -- 83 rsc.io/quote v1.1.0 h1:a3YaZoizPtXyv6ZsJ74oo2L4/bwOSTKMY7MAyo4O/1c= 84 85 -- go.sum.bad2 -- 86 rsc.io/quote v1.1.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl1=