...

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

Documentation: cmd/go/testdata/script

     1# https://golang.org/issue/41297: 'go list -m' should not require go.sum with
     2# -versions or when all args are version queries.
     3
     4go mod init m
     5go mod edit -require=rsc.io/quote@v1.5.1
     6
     7go list -m -mod=readonly rsc.io/quote@latest
     8stdout '^rsc\.io/quote v1\.5\.2$'
     9! stderr .
    10
    11go list -m -mod=readonly -versions rsc.io/quote
    12stdout 'rsc\.io/quote v1\.0\.0 .* v1\.5\.3-pre1$'
    13! stderr .
    14
    15# Incidentally fetching the required version of a module records its checksum,
    16# just because it happens to be in the build list, and recording the checksum
    17# triggers an error under -mod=readonly.
    18#
    19# TODO(#41297): This should not be an error.
    20! go list -m -mod=readonly rsc.io/quote@<v1.5.2
    21stderr '^go: updates to go.sum needed, disabled by -mod=readonly$'
    22! stderr 'missing go.sum entry'
    23
    24# Attempting to list the versions of a module that is not a root dependency
    25# causes the build list to be resolved (so that the selected version can *also*
    26# be identified, even though it is not relevant to this particular output).
    27# That, in turn, causes us to need checksums for the go.sum files for the
    28# modules in the module graph.
    29#
    30# TODO(#41297): This should not be an error either.
    31! go list -m -mod=readonly -versions rsc.io/sampler
    32stderr '^go: rsc\.io/quote@v1\.5\.1: missing go\.sum entry for go.mod file; to add it:\n\tgo mod download rsc\.io/quote$'

View as plain text