github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/src/cmd/go/testdata/script/mod_verify.txt (about)

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