...

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

Documentation: cmd/go/testdata/script

     1[!net:proxy.golang.org] skip
     2[!net:sum.golang.org] skip
     3
     4env GO111MODULE=on
     5[go-builder] env GOSUMDB=
     6[!go-builder] env GOSUMDB=sum.golang.org  # Set explicitly in case GOROOT/go.env is modified.
     7env GOPATH=$WORK/gopath1
     8
     9# With a file-based proxy with an empty checksum directory,
    10# downloading a new module should fail, even if a subsequent
    11# proxy contains a more complete mirror of the sum database.
    12#
    13# TODO(bcmills): The error message here is a bit redundant.
    14# It comes from the sumweb package, which isn't yet producing structured errors.
    15[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
    16[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
    17! go get golang.org/x/text@v0.3.2
    18stderr '^go: golang.org/x/text@v0.3.2: verifying module: golang.org/x/text@v0.3.2: reading file://.*/sumdb/sum.golang.org/lookup/golang.org/x/text@v0.3.2: (no such file or directory|.*cannot find the path specified.*)'
    19
    20# If the proxy does not claim to support the database,
    21# checksum verification should fall through to the next proxy,
    22# and downloading should succeed.
    23[GOOS:windows] env GOPROXY=file:///$WORK/emptyproxy,https://proxy.golang.org
    24[!GOOS:windows] env GOPROXY=file://$WORK/emptyproxy,https://proxy.golang.org
    25go get golang.org/x/text@v0.3.2
    26
    27# After a successful sumdb lookup, the lookup can be repeated
    28# using the download cache as a proxy.
    29cp supported $GOPATH/pkg/mod/cache/download/sumdb/sum.golang.org/supported
    30[GOOS:windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download,file:///$WORK/sumproxy
    31[!GOOS:windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download,file://$WORK/sumproxy
    32env GOPATH=$WORK/gopath2
    33rm go.sum
    34go get -x -v golang.org/x/text@v0.3.2
    35
    36# Once the checksum is present in the go.sum file,
    37# an empty file-based sumdb can be used in conjunction with
    38# a fallback module mirror.
    39grep golang.org/x/text go.sum
    40env GOPATH=$WORK/gopath3
    41[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy
    42[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy
    43! go get golang.org/x/text@v0.3.2
    44[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
    45[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
    46go get golang.org/x/text@v0.3.2
    47
    48-- supported --
    49
    50-- go.mod --
    51module example.com
    52go 1.13
    53-- $WORK/emptyproxy/README.md --
    54This proxy contains no modules.
    55-- $WORK/sumproxy/README.md --
    56This proxy contains no modules.
    57-- $WORK/sumproxy/sumdb/sum.golang.org/supported --
    58This proxy blocks checksum downloads from sum.golang.org.

View as plain text