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