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

     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
    17  env GOMODCACHE=$WORK/modcache # we clean the modcache below
    18  env GOSUMDB=sum.golang.org
    19  env GOPROXY=direct
    20  
    21  go get rsc.io/quote@v1.5.2
    22  cp 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  
    29  go clean -modcache
    30  env GOSUMDB=sum.golang.org
    31  env GOPROXY=https://proxy.golang.org,direct
    32  
    33  go list -x -m all  # Download go.mod files.
    34  ! stderr github
    35  stderr proxy.golang.org/rsc.io/quote
    36  ! stderr sum.golang.org/tile
    37  ! stderr sum.golang.org/lookup/rsc.io/quote
    38  
    39  go list -x -deps rsc.io/quote  # Download module source.
    40  ! stderr github
    41  stderr proxy.golang.org/rsc.io/quote
    42  ! stderr sum.golang.org/tile
    43  ! stderr sum.golang.org/lookup/rsc.io/quote
    44  
    45  cmp 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  
    52  rm go.sum
    53  
    54  go list -mod=mod -x -m all  # Add checksums for go.mod files.
    55  stderr sum.golang.org/tile
    56  ! stderr github
    57  ! stderr proxy.golang.org/rsc.io/quote
    58  stderr sum.golang.org/lookup/rsc.io/quote
    59  
    60  go 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  
    63  cmp go.sum saved.sum
    64  
    65  
    66  # test fallback to direct
    67  
    68  env GOPROXY=$TESTGO_404_PROXY_ADDR,direct
    69  go clean -modcache
    70  rm go.sum
    71  
    72  go list -mod=mod -x -m all  # Download go.mod files
    73  stderr $TESTGO_404_PROXY_ADDR.*'404 Not Found'
    74  stderr github.com/rsc
    75  
    76  go list -mod=mod -x rsc.io/quote  # Download module source.
    77  stderr $TESTGO_404_PROXY_ADDR.*'404 Not Found'
    78  stderr github.com/rsc
    79  
    80  cmp go.sum saved.sum
    81  
    82  
    83  -- go.mod --
    84  module m
    85  

View as plain text