aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/govcs.txt
blob: 4180d7da6ab159addd14d344d7d5135e07d50f9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
env GO111MODULE=on
env proxy=$GOPROXY
env GOPROXY=direct

# GOVCS stops go get
env GOVCS='*:none'
! go get github.com/google/go-cmp
stderr '^go get: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'
env GOPRIVATE='github.com/google'
! go get github.com/google/go-cmp
stderr '^go get: GOVCS disallows using git for private github.com/google/go-cmp; see ''go help vcs''$'

# public pattern works
env GOPRIVATE='github.com/google'
env GOVCS='public:all,private:none'
! go get github.com/google/go-cmp
stderr '^go get: GOVCS disallows using git for private github.com/google/go-cmp; see ''go help vcs''$'

# private pattern works
env GOPRIVATE='hubgit.com/google'
env GOVCS='private:all,public:none'
! go get github.com/google/go-cmp
stderr '^go get: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'

# other patterns work (for more patterns, see TestGOVCS)
env GOPRIVATE=
env GOVCS='github.com:svn|hg'
! go get github.com/google/go-cmp
stderr '^go get: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'
env GOVCS='github.com/google/go-cmp/inner:git,github.com:svn|hg'
! go get github.com/google/go-cmp
stderr '^go get: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'

# bad patterns are reported (for more bad patterns, see TestGOVCSErrors)
env GOVCS='git'
! go get github.com/google/go-cmp
stderr '^go get github.com/google/go-cmp: malformed entry in GOVCS \(missing colon\): "git"$'

env GOVCS=github.com:hg,github.com:git
! go get github.com/google/go-cmp
stderr '^go get github.com/google/go-cmp: unreachable pattern in GOVCS: "github.com:git" after "github.com:hg"$'

# bad GOVCS patterns do not stop commands that do not need to check VCS
go list
env GOPROXY=$proxy
go get -d rsc.io/quote # ok because used proxy
env GOPROXY=direct

# svn is disallowed by default
env GOPRIVATE=
env GOVCS=
! go get rsc.io/nonexist.svn/hello
stderr '^go get rsc.io/nonexist.svn/hello: GOVCS disallows using svn for public rsc.io/nonexist.svn; see ''go help vcs''$'

# fossil is disallowed by default
env GOPRIVATE=
env GOVCS=
! go get rsc.io/nonexist.fossil/hello
stderr '^go get rsc.io/nonexist.fossil/hello: GOVCS disallows using fossil for public rsc.io/nonexist.fossil; see ''go help vcs''$'

# bzr is disallowed by default
env GOPRIVATE=
env GOVCS=
! go get rsc.io/nonexist.bzr/hello
stderr '^go get rsc.io/nonexist.bzr/hello: GOVCS disallows using bzr for public rsc.io/nonexist.bzr; see ''go help vcs''$'

# git is OK by default
env GOVCS=
env GONOSUMDB='*'
[net] [exec:git] [!short] go get rsc.io/sampler

# hg is OK by default
env GOVCS=
env GONOSUMDB='*'
[net] [exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello

# git can be disallowed
env GOVCS=public:hg
! go get rsc.io/nonexist.git/hello
stderr '^go get rsc.io/nonexist.git/hello: GOVCS disallows using git for public rsc.io/nonexist.git; see ''go help vcs''$'

# hg can be disallowed
env GOVCS=public:git
! go get rsc.io/nonexist.hg/hello
stderr '^go get rsc.io/nonexist.hg/hello: GOVCS disallows using hg for public rsc.io/nonexist.hg; see ''go help vcs''$'

# Repeat in GOPATH mode. Error texts slightly different.

env GO111MODULE=off

# GOVCS stops go get
env GOVCS='*:none'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'
env GOPRIVATE='github.com/google'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: GOVCS disallows using git for private github.com/google/go-cmp; see ''go help vcs''$'

# public pattern works
env GOPRIVATE='github.com/google'
env GOVCS='public:all,private:none'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: GOVCS disallows using git for private github.com/google/go-cmp; see ''go help vcs''$'

# private pattern works
env GOPRIVATE='hubgit.com/google'
env GOVCS='private:all,public:none'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'

# other patterns work (for more patterns, see TestGOVCS)
env GOPRIVATE=
env GOVCS='github.com:svn|hg'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'
env GOVCS='github.com/google/go-cmp/inner:git,github.com:svn|hg'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: GOVCS disallows using git for public github.com/google/go-cmp; see ''go help vcs''$'

# bad patterns are reported (for more bad patterns, see TestGOVCSErrors)
env GOVCS='git'
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: malformed entry in GOVCS \(missing colon\): "git"$'

env GOVCS=github.com:hg,github.com:git
! go get github.com/google/go-cmp
stderr '^package github.com/google/go-cmp: unreachable pattern in GOVCS: "github.com:git" after "github.com:hg"$'

# bad GOVCS patterns do not stop commands that do not need to check VCS
go list

# svn is disallowed by default
env GOPRIVATE=
env GOVCS=
! go get rsc.io/nonexist.svn/hello
stderr '^package rsc.io/nonexist.svn/hello: GOVCS disallows using svn for public rsc.io/nonexist.svn; see ''go help vcs''$'

# fossil is disallowed by default
env GOPRIVATE=
env GOVCS=
! go get rsc.io/nonexist.fossil/hello
stderr '^package rsc.io/nonexist.fossil/hello: GOVCS disallows using fossil for public rsc.io/nonexist.fossil; see ''go help vcs''$'

# bzr is disallowed by default
env GOPRIVATE=
env GOVCS=
! go get rsc.io/nonexist.bzr/hello
stderr '^package rsc.io/nonexist.bzr/hello: GOVCS disallows using bzr for public rsc.io/nonexist.bzr; see ''go help vcs''$'

# git is OK by default
env GOVCS=
env GONOSUMDB='*'
[net] [exec:git] [!short] go get rsc.io/sampler

# hg is OK by default
env GOVCS=
env GONOSUMDB='*'
[net] [exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello

# git can be disallowed
env GOVCS=public:hg
! go get rsc.io/nonexist.git/hello
stderr '^package rsc.io/nonexist.git/hello: GOVCS disallows using git for public rsc.io/nonexist.git; see ''go help vcs''$'

# hg can be disallowed
env GOVCS=public:git
! go get rsc.io/nonexist.hg/hello
stderr '^package rsc.io/nonexist.hg/hello: GOVCS disallows using hg for public rsc.io/nonexist.hg; see ''go help vcs''$'

-- go.mod --
module m

-- p.go --
package p