| env GO111MODULE=on |
| env TESTPROXY=$GOPROXY |
| env GOPATH=$WORK/gopath1 |
| |
| mkdir $WORK/sumproxy/sumdb/$TESTGO_SUMDB |
| cp supported $WORK/sumproxy/sumdb/$TESTGO_SUMDB/supported |
| |
| # With a file-based proxy with an empty checksum directory, |
| # downloading a new module should fail, even if a subsequent |
| # proxy contains a more complete mirror of the sum database. |
| # |
| # TODO(bcmills): The error message here is a bit redundant. |
| # It comes from the sumweb package, which isn't yet producing structured errors. |
| [GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,$TESTPROXY |
| [!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,$TESTPROXY |
| ! go get rsc.io/quote@v1.5.2 |
| stderr '^go: rsc.io/quote@v1.5.2: verifying module: rsc.io/quote@v1.5.2: reading file://.*/sumdb/.*/lookup/rsc.io/quote@v1.5.2: (no such file or directory|.*cannot find the path specified.*)' |
| |
| # If the proxy does not claim to support the database, |
| # checksum verification should fall through to the next proxy, |
| # and downloading should succeed. |
| [GOOS:windows] env GOPROXY=file:///$WORK/emptyproxy,$TESTPROXY |
| [!GOOS:windows] env GOPROXY=file://$WORK/emptyproxy,$TESTPROXY |
| go get rsc.io/quote@v1.5.2 |
| |
| # After a successful sumdb lookup, the lookup can be repeated |
| # using the download cache as a proxy. |
| cp supported $GOPATH/pkg/mod/cache/download/sumdb/$TESTGO_SUMDB/supported |
| [GOOS:windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download,file:///$WORK/sumproxy |
| [!GOOS:windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download,file://$WORK/sumproxy |
| env GOPATH=$WORK/gopath2 |
| rm go.sum |
| go get -x -v rsc.io/quote@v1.5.2 |
| |
| # Once the checksum is present in the go.sum file, |
| # an empty file-based sumdb can be used in conjunction with |
| # a fallback module mirror. |
| grep rsc.io/quote go.sum |
| env GOPATH=$WORK/gopath3 |
| [GOOS:windows] env GOPROXY=file:///$WORK/sumproxy |
| [!GOOS:windows] env GOPROXY=file://$WORK/sumproxy |
| ! go get rsc.io/quote@v1.5.2 |
| [GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,$TESTPROXY |
| [!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,$TESTPROXY |
| go get rsc.io/quote@v1.5.2 |
| |
| -- supported -- |
| |
| -- go.mod -- |
| module example.com |
| go 1.13 |
| -- $WORK/emptyproxy/README.md -- |
| This proxy contains no modules. |