| 1 |
env GO111MODULE=on |
| 2 |
env proxy=$GOPROXY |
| 3 |
env GOPROXY=direct |
| 4 |
|
| 5 |
# GOVCS stops go get |
| 6 |
env GOVCS='*:none' |
| 7 |
! go get github.com/google/go-cmp |
| 8 |
stderr '^go: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$' |
| 9 |
env GOPRIVATE='github.com/google' |
| 10 |
! go get github.com/google/go-cmp |
| 11 |
stderr '^go: GOVCS disallows using git for private github.com/google/go-cmp; see ''go help vcs''$' |
| 12 |
|
| 13 |
# public pattern works |
| 14 |
env GOPRIVATE='github.com/google' |
| 15 |
env GOVCS='public:all,private:none' |
| 16 |
! go get github.com/google/go-cmp |
| 17 |
stderr '^go: GOVCS disallows using git for private github.com/google/go-cmp; see ''go help vcs''$' |
| 18 |
|
| 19 |
# private pattern works |
| 20 |
env GOPRIVATE='hubgit.com/google' |
| 21 |
env GOVCS='private:all,public:none' |
| 22 |
! go get github.com/google/go-cmp |
| 23 |
stderr '^go: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$' |
| 24 |
|
| 25 |
# other patterns work (for more patterns, see TestGOVCS) |
| 26 |
env GOPRIVATE= |
| 27 |
env GOVCS='github.com:svn|hg' |
| 28 |
! go get github.com/google/go-cmp |
| 29 |
stderr '^go: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$' |
| 30 |
env GOVCS='github.com/google/go-cmp/inner:git,github.com:svn|hg' |
| 31 |
! go get github.com/google/go-cmp |
| 32 |
stderr '^go: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$' |
| 33 |
|
| 34 |
# bad patterns are reported (for more bad patterns, see TestGOVCSErrors) |
| 35 |
env GOVCS='git' |
| 36 |
! go get github.com/google/go-cmp |
| 37 |
stderr '^go: github.com/google/go-cmp: malformed entry in GOVCS \(missing colon\): "git"$' |
| 38 |
|
| 39 |
env GOVCS=github.com:hg,github.com:git |
| 40 |
! go get github.com/google/go-cmp |
| 41 |
stderr '^go: github.com/google/go-cmp: unreachable pattern in GOVCS: "github.com:git" after "github.com:hg"$' |
| 42 |
|
| 43 |
# bad GOVCS patterns do not stop commands that do not need to check VCS |
| 44 |
go list |
| 45 |
env GOPROXY=$proxy |
| 46 |
go get rsc.io/quote # ok because used proxy |
| 47 |
env GOPROXY=direct |
| 48 |
|
| 49 |
# svn is disallowed by default |
| 50 |
env GOPRIVATE= |
| 51 |
env GOVCS= |
| 52 |
! go get rsc.io/nonexist.svn/hello |
| 53 |
stderr '^go: rsc.io/nonexist.svn/hello: GOVCS disallows using svn for public rsc.io/nonexist.svn; see ''go help vcs''$' |
| 54 |
|
| 55 |
# fossil is disallowed by default |
| 56 |
env GOPRIVATE= |
| 57 |
env GOVCS= |
| 58 |
! go get rsc.io/nonexist.fossil/hello |
| 59 |
stderr '^go: rsc.io/nonexist.fossil/hello: GOVCS disallows using fossil for public rsc.io/nonexist.fossil; see ''go help vcs''$' |
| 60 |
|
| 61 |
# bzr is disallowed by default |
| 62 |
env GOPRIVATE= |
| 63 |
env GOVCS= |
| 64 |
! go get rsc.io/nonexist.bzr/hello |
| 65 |
stderr '^go: rsc.io/nonexist.bzr/hello: GOVCS disallows using bzr for public rsc.io/nonexist.bzr; see ''go help vcs''$' |
| 66 |
|
| 67 |
# git is OK by default |
| 68 |
env GOVCS= |
| 69 |
env GONOSUMDB='*' |
| 70 |
[net:rsc.io] [git] [!short] go get rsc.io/sampler |
| 71 |
|
| 72 |
# hg is OK by default |
| 73 |
env GOVCS= |
| 74 |
env GONOSUMDB='*' |
| 75 |
[exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello |
| 76 |
|
| 77 |
# git can be disallowed |
| 78 |
env GOVCS=public:hg |
| 79 |
! go get rsc.io/nonexist.git/hello |
| 80 |
stderr '^go: rsc.io/nonexist.git/hello: GOVCS disallows using git for public rsc.io/nonexist.git; see ''go help vcs''$' |
| 81 |
|
| 82 |
# hg can be disallowed |
| 83 |
env GOVCS=public:git |
| 84 |
! go get rsc.io/nonexist.hg/hello |
| 85 |
stderr '^go: rsc.io/nonexist.hg/hello: GOVCS disallows using hg for public rsc.io/nonexist.hg; see ''go help vcs''$' |
| 86 |
|
| 87 |
-- go.mod -- |
| 88 |
module m |
| 89 |
|
| 90 |
-- p.go -- |
| 91 |
package p |