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

     1  env GO111MODULE=on
     2  env sumdb=$GOSUMDB
     3  env proxy=$GOPROXY
     4  env GOPRIVATE GOPROXY GONOPROXY GOSUMDB GONOSUMDB
     5  env dbname=localhost.localdev/sumdb
     6  
     7  # disagree with sumdb fails
     8  cp go.mod.orig go.mod
     9  env GOSUMDB=$sumdb' '$proxy/sumdb-wrong
    10  ! go get rsc.io/quote
    11  stderr 'SECURITY ERROR'
    12  
    13  # GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text
    14  env GONOSUMDB='*/quote,*/*mple*,golang.org/x'
    15  go get rsc.io/quote
    16  rm go.sum
    17  env GOPRIVATE='*/quote,*/*mple*,golang.org/x'
    18  env GONOPROXY=none # that is, proxy all despite GOPRIVATE
    19  go get rsc.io/quote
    20  
    21  # Download .info files needed for 'go list -m all' later.
    22  # TODO(#42723): either 'go list -m' should not read these files,
    23  # or 'go get' and 'go mod tidy' should download them.
    24  go list -m all
    25  stdout '^golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c$'
    26  
    27  # When GOPROXY is not empty but contains no entries, an error should be reported.
    28  env GOPROXY=','
    29  ! go get golang.org/x/text
    30  stderr '^go: golang.org/x/text: GOPROXY list is not the empty string, but contains no entries$'
    31  
    32  # When GOPROXY=off, fetching modules not matched by GONOPROXY fails.
    33  env GONOPROXY=*/fortune
    34  env GOPROXY=off
    35  ! go get golang.org/x/text
    36  stderr '^go: golang.org/x/text: module lookup disabled by GOPROXY=off$'
    37  
    38  [short] skip 'the rest of the test uses git'
    39  
    40  # GONOPROXY bypasses proxy
    41  [!git] skip
    42  env GOPROXY=$proxy
    43  env GOSUMDB=$sumdb
    44  env GOPRIVATE=none
    45  env GONOPROXY='*/git/proxyonly.git'
    46  ! go get vcs-test.golang.org/git/proxyonly.git  # does not exist in vcstest, only on test proxy
    47  stderr 'git ls-remote'
    48  
    49  env GOSUMDB=off
    50  env GONOPROXY=
    51  env GOPRIVATE='*/git/tagtests.git'
    52  go get vcs-test.golang.org/git/tagtests.git
    53  go list -m all
    54  stdout '^vcs-test.golang.org/git/tagtests.git v0.2.2$'
    55  ! stdout 'tagtests.git v0.1.0' # should not have the version from the proxy
    56  
    57  -- go.mod.orig --
    58  module m
    59  

View as plain text