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

     1  # Commands used to debug the module graph should not write go.mod or go.sum
     2  # or report errors when those files need to be updated.
     3  
     4  # Everything's okay initially.
     5  go list -m all
     6  
     7  # Downgrading sampler makes go.mod inconsistent, but 'go mod graph',
     8  # 'go mod verify', and 'go mod why' still work.
     9  cp go.mod go.mod.orig
    10  go mod edit -require=rsc.io/sampler@v1.2.0
    11  cp go.mod go.mod.edit
    12  ! go list -m all
    13  stderr 'updates to go.mod needed'
    14  
    15  go mod graph
    16  cmp stdout graph.want
    17  cmp go.mod go.mod.edit
    18  
    19  go mod verify
    20  stdout '^all modules verified$'
    21  cmp go.mod go.mod.edit
    22  
    23  go mod why rsc.io/sampler
    24  cmp stdout why.want
    25  cmp go.mod go.mod.edit
    26  
    27  go mod why -m rsc.io/sampler
    28  cmp stdout why.want
    29  cmp go.mod go.mod.edit
    30  
    31  cp go.mod.orig go.mod
    32  
    33  # Removing go.sum breaks other commands, but 'go mod graph' and
    34  # 'go mod why' still work.
    35  rm go.sum
    36  ! go list -m all
    37  stderr 'missing go.sum entry'
    38  
    39  go mod graph
    40  cmp stdout graph.want
    41  ! exists go.sum
    42  
    43  go mod verify
    44  stdout '^all modules verified$'
    45  ! exists go.sum
    46  
    47  go mod why rsc.io/sampler
    48  cmp stdout why.want
    49  ! exists go.sum
    50  
    51  go mod why -m rsc.io/sampler
    52  cmp stdout why.want
    53  ! exists go.sum
    54  
    55  -- go.mod --
    56  module m
    57  
    58  go 1.18
    59  
    60  require rsc.io/quote v1.5.2
    61  
    62  require (
    63  	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
    64  	rsc.io/sampler v1.3.0 // indirect
    65  	rsc.io/testonly v1.0.0 // indirect
    66  )
    67  -- go.sum --
    68  golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:pvCbr/wm8HzDD3fVywevekufpn6tCGPY3spdHeZJEsw=
    69  golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
    70  rsc.io/quote v1.5.2 h1:3fEykkD9k7lYzXqCYrwGAf7iNhbk4yCjHmKBN9td4L0=
    71  rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0=
    72  rsc.io/sampler v1.2.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
    73  rsc.io/sampler v1.3.0 h1:HLGR/BgEtI3r0uymSP/nl2uPLsUnNJX8toRyhfpBTII=
    74  rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
    75  rsc.io/testonly v1.0.0 h1:K/VWHdO+Jv7woUXG0GzVNx1czBXUt3Ib1deaMn+xk64=
    76  rsc.io/testonly v1.0.0/go.mod h1:OqmGbIFOcF+XrFReLOGZ6BhMM7uMBiQwZsyNmh74SzY=
    77  -- use.go --
    78  package use
    79  
    80  import _ "rsc.io/quote"
    81  -- graph.want --
    82  m golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c
    83  m rsc.io/quote@v1.5.2
    84  m rsc.io/sampler@v1.3.0
    85  m rsc.io/testonly@v1.0.0
    86  rsc.io/quote@v1.5.2 rsc.io/sampler@v1.3.0
    87  rsc.io/sampler@v1.3.0 golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c
    88  -- why.want --
    89  # rsc.io/sampler
    90  m
    91  rsc.io/quote
    92  rsc.io/sampler
    93  

View as plain text