| 1 |
[!net:proxy.golang.org] skip |
| 2 |
[!net:sum.golang.org] skip |
| 3 |
|
| 4 |
env GO111MODULE=on |
| 5 |
[go-builder] env GOSUMDB= |
| 6 |
[!go-builder] env GOSUMDB=sum.golang.org # Set explicitly in case GOROOT/go.env is modified. |
| 7 |
env 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/[email protected] |
| 18 |
stderr '^go: golang.org/x/[email protected]: verifying module: golang.org/x/[email protected]: reading file://.*/sumdb/sum.golang.org/lookup/golang.org/x/[email protected]: (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 |
| 25 |
go get golang.org/x/[email protected] |
| 26 |
|
| 27 |
# After a successful sumdb lookup, the lookup can be repeated |
| 28 |
# using the download cache as a proxy. |
| 29 |
cp 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 |
| 32 |
env GOPATH=$WORK/gopath2 |
| 33 |
rm go.sum |
| 34 |
go get -x -v golang.org/x/[email protected] |
| 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. |
| 39 |
grep golang.org/x/text go.sum |
| 40 |
env 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/[email protected] |
| 44 |
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org |
| 45 |
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org |
| 46 |
go get golang.org/x/[email protected] |
| 47 |
|
| 48 |
-- supported -- |
| 49 |
|
| 50 |
-- go.mod -- |
| 51 |
module example.com |
| 52 |
go 1.13 |
| 53 |
-- $WORK/emptyproxy/README.md -- |
| 54 |
This proxy contains no modules. |
| 55 |
-- $WORK/sumproxy/README.md -- |
| 56 |
This proxy contains no modules. |
| 57 |
-- $WORK/sumproxy/sumdb/sum.golang.org/supported -- |
| 58 |
This proxy blocks checksum downloads from sum.golang.org. |