...

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

Documentation: cmd/go/testdata/script

     1# Confirm our build list.
     2cp go.sum.buildlist-only go.sum
     3go list -m all
     4stdout '^example.com/ambiguous/a v1.0.0$'
     5stdout '^example.com/ambiguous/a/b v0.0.0-empty$'
     6
     7# If two modules could provide a package, but only one does,
     8# 'go mod tidy' should retain sums for both zips.
     9go mod tidy
    10grep '^example.com/ambiguous/a v1.0.0 h1:' go.sum
    11grep '^example.com/ambiguous/a/b v0.0.0-empty h1:' go.sum
    12
    13# 'go mod download' should also add sums.
    14cp go.sum.buildlist-only go.sum
    15go mod download example.com/ambiguous/a
    16grep '^example.com/ambiguous/a v1.0.0 h1:' go.sum
    17! grep '^example.com/ambiguous/a/b v0.0.0-empty h1:' go.sum
    18go mod download example.com/ambiguous/a/b
    19grep '^example.com/ambiguous/a/b v0.0.0-empty h1:' go.sum
    20
    21# If two modules could provide a package, and we're missing a sum for one,
    22# we should see a missing sum error, even if we have a sum for a module that
    23# provides the package.
    24cp go.sum.a-only go.sum
    25! go list example.com/ambiguous/a/b
    26stderr '^missing go.sum entry needed to verify package example.com/ambiguous/a/b is provided by exactly one module; to add:\n\tgo mod download example.com/ambiguous/a/b$'
    27! go list -deps .
    28stderr '^use.go:3:8: missing go.sum entry needed to verify package example.com/ambiguous/a/b \(imported by m\) is provided by exactly one module; to add:\n\tgo get m$'
    29
    30cp go.sum.b-only go.sum
    31! go list example.com/ambiguous/a/b
    32stderr '^missing go.sum entry for module providing package example.com/ambiguous/a/b; to add:\n\tgo mod download example.com/ambiguous/a$'
    33! go list -deps .
    34stderr '^use.go:3:8: missing go.sum entry for module providing package example.com/ambiguous/a/b \(imported by m\); to add:\n\tgo get m$'
    35
    36cp go.sum.buildlist-only go.sum
    37! go list example.com/ambiguous/a/b
    38stderr '^missing go.sum entry for module providing package example.com/ambiguous/a/b; to add:\n\tgo mod download example.com/ambiguous/a example.com/ambiguous/a/b$'
    39! go list -deps .
    40stderr '^use.go:3:8: missing go.sum entry for module providing package example.com/ambiguous/a/b \(imported by m\); to add:\n\tgo get m$'
    41
    42-- go.mod --
    43module m
    44
    45go 1.15
    46
    47require example.com/ambiguous/a v1.0.0
    48-- go.sum.buildlist-only --
    49example.com/ambiguous/a v1.0.0/go.mod h1:TrBl/3xTPFJ2gmMIYz53h2gkNtg0dokszEMuyS1QEb0=
    50example.com/ambiguous/a/b v0.0.0-empty/go.mod h1:MajJq5jPEBnnXP+NTWIeXX7kwaPS1sbVEJdooTmsePQ=
    51-- go.sum.a-only --
    52example.com/ambiguous/a v1.0.0 h1:pGZhTXy6+titE2rNfwHwJykSjXDR4plO52PfZrBM0T8=
    53example.com/ambiguous/a v1.0.0/go.mod h1:TrBl/3xTPFJ2gmMIYz53h2gkNtg0dokszEMuyS1QEb0=
    54example.com/ambiguous/a/b v0.0.0-empty/go.mod h1:MajJq5jPEBnnXP+NTWIeXX7kwaPS1sbVEJdooTmsePQ=
    55-- go.sum.b-only --
    56example.com/ambiguous/a v1.0.0/go.mod h1:TrBl/3xTPFJ2gmMIYz53h2gkNtg0dokszEMuyS1QEb0=
    57example.com/ambiguous/a/b v0.0.0-empty h1:xS29ReXXuhjT7jc79mo91h/PevaZ2oS9PciF1DucXtg=
    58example.com/ambiguous/a/b v0.0.0-empty/go.mod h1:MajJq5jPEBnnXP+NTWIeXX7kwaPS1sbVEJdooTmsePQ=
    59-- use.go --
    60package use
    61
    62import _ "example.com/ambiguous/a/b"

View as plain text