github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_sumdb_proxy.txt (about)

     1  env GO111MODULE=on
     2  env sumdb=$GOSUMDB
     3  env proxy=$GOPROXY
     4  env GOPROXY GONOPROXY GOSUMDB GONOSUMDB
     5  
     6  # basic fetch (through proxy) works
     7  cp go.mod.orig go.mod
     8  go get -d rsc.io/fortune@v1.0.0 # note: must use test proxy, does not exist in real world
     9  rm $GOPATH/pkg/mod/cache/download/sumdb # rm sumdb cache but NOT package download cache
    10  rm go.sum
    11  
    12  # can fetch by explicit URL
    13  cp go.mod.orig go.mod
    14  env GOSUMDB=$sumdb' '$proxy/sumdb-direct
    15  go get -d rsc.io/fortune@v1.0.0
    16  rm $GOPATH/pkg/mod/cache/download/sumdb
    17  rm go.sum
    18  
    19  # direct access fails (because localhost.localdev does not exist)
    20  # The text of the error message is hard to predict because some DNS servers
    21  # will resolve unknown domains like localhost.localdev to a real IP
    22  # to serve ads.
    23  cp go.mod.orig go.mod
    24  env GOSUMDB=$sumdb
    25  env GOPROXY=direct
    26  ! go get -d rsc.io/fortune@v1.0.0
    27  stderr 'verifying.*localhost.localdev'
    28  rm $GOPATH/pkg/mod/cache/download/sumdb
    29  rm go.sum
    30  
    31  # proxy 404 falls back to direct access (which fails)
    32  cp go.mod.orig go.mod
    33  env GOSUMDB=$sumdb
    34  env GOPROXY=$proxy/sumdb-404
    35  ! go get -d rsc.io/fortune@v1.0.0
    36  stderr 'verifying.*localhost.localdev'
    37  rm $GOPATH/pkg/mod/cache/download/sumdb
    38  rm go.sum
    39  
    40  # proxy non-200/404/410 stops direct access
    41  cp go.mod.orig go.mod
    42  env GOSUMDB=$sumdb
    43  env GOPROXY=$proxy/sumdb-503
    44  ! go get -d rsc.io/fortune@v1.0.0
    45  stderr '503 Service Unavailable'
    46  rm $GOPATH/pkg/mod/cache/download/sumdb
    47  rm go.sum
    48  
    49  -- go.mod.orig --
    50  module m