...

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

Documentation: cmd/go/testdata/script

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

View as plain text