...

Text file src/cmd/go/internal/verylongtest/testdata/script/mod_sumdb_golang.txt

Documentation: cmd/go/internal/verylongtest/testdata/script

     1# Test default GOPROXY and GOSUMDB
     2[go-builder] env GOPROXY=
     3[go-builder] env GOSUMDB=
     4[go-builder] go env GOPROXY
     5[go-builder] stdout '^https://proxy.golang.org,direct$'
     6[go-builder] go env GOSUMDB
     7[go-builder] stdout '^sum.golang.org$'
     8[go-builder] env GOPROXY=https://proxy.golang.org
     9[go-builder] go env GOSUMDB
    10[go-builder] stdout '^sum.golang.org$'
    11
    12# Download direct from github.
    13
    14[!net:proxy.golang.org] skip
    15[!net:sum.golang.org] skip
    16[!git] skip
    17env GOMODCACHE=$WORK/modcache # we clean the modcache below
    18env GOSUMDB=sum.golang.org
    19env GOPROXY=direct
    20
    21go get rsc.io/quote@v1.5.2
    22cp go.sum saved.sum
    23
    24
    25# Download from proxy.golang.org with go.sum entry already.
    26# Use 'go list' instead of 'go get' since the latter may download extra go.mod
    27# files not listed in go.sum.
    28
    29go clean -modcache
    30env GOSUMDB=sum.golang.org
    31env GOPROXY=https://proxy.golang.org,direct
    32
    33go list -x -m all  # Download go.mod files.
    34! stderr github
    35stderr proxy.golang.org/rsc.io/quote
    36! stderr sum.golang.org/tile
    37! stderr sum.golang.org/lookup/rsc.io/quote
    38
    39go list -x -deps rsc.io/quote  # Download module source.
    40! stderr github
    41stderr proxy.golang.org/rsc.io/quote
    42! stderr sum.golang.org/tile
    43! stderr sum.golang.org/lookup/rsc.io/quote
    44
    45cmp go.sum saved.sum
    46
    47
    48# Download again.
    49# Should use the checksum database to validate new go.sum lines,
    50# but not need to fetch any new data from the proxy.
    51
    52rm go.sum
    53
    54go list -mod=mod -x -m all  # Add checksums for go.mod files.
    55stderr sum.golang.org/tile
    56! stderr github
    57! stderr proxy.golang.org/rsc.io/quote
    58stderr sum.golang.org/lookup/rsc.io/quote
    59
    60go list -mod=mod -x rsc.io/quote  # Add checksums for module source.
    61! stderr .  # Adds checksums, but for entities already in the module cache.
    62
    63cmp go.sum saved.sum
    64
    65
    66# test fallback to direct
    67
    68env GOPROXY=$TESTGO_404_PROXY_ADDR,direct
    69go clean -modcache
    70rm go.sum
    71
    72go list -mod=mod -x -m all  # Download go.mod files
    73stderr $TESTGO_404_PROXY_ADDR.*'404 Not Found'
    74stderr github.com/rsc
    75
    76go list -mod=mod -x rsc.io/quote  # Download module source.
    77stderr $TESTGO_404_PROXY_ADDR.*'404 Not Found'
    78stderr github.com/rsc
    79
    80cmp go.sum saved.sum
    81
    82
    83-- go.mod --
    84module m

View as plain text