Text file src/cmd/go/testdata/script/mod_tidy_sum.txt

     1  env GO111MODULE=on
     2  
     3  # go.sum should list directly used modules and dependencies
     4  go get rsc.io/quote@v1.5.2
     5  go mod tidy
     6  grep rsc.io/sampler go.sum
     7  
     8  # go.sum should not normally lose old entries
     9  go get rsc.io/quote@v1.0.0
    10  grep 'rsc.io/quote v1.0.0' go.sum
    11  grep 'rsc.io/quote v1.5.2' go.sum
    12  grep rsc.io/sampler go.sum
    13  
    14  # go mod tidy should clear dead entries from go.sum
    15  go mod tidy
    16  grep 'rsc.io/quote v1.0.0' go.sum
    17  ! grep 'rsc.io/quote v1.5.2' go.sum
    18  ! grep rsc.io/sampler go.sum
    19  
    20  # go.sum with no entries is OK to keep
    21  # (better for version control not to delete and recreate.)
    22  cp x.go.noimports x.go
    23  go mod tidy
    24  exists go.sum
    25  ! grep . go.sum
    26  
    27  -- go.mod --
    28  module x
    29  -- x.go --
    30  package x
    31  import _ "rsc.io/quote"
    32  -- x.go.noimports --
    33  package x
    34  

View as plain text