Skip to content

Commit 0483ff7

Browse files
myitcvmvdan
authored andcommitted
ci: changes for go1.13beta1
Also: * make explicit the entire Go version matrix * make goproxytest honour the 404 behaviour expected by cmd/go in tip as a result of https://go-review.googlesource.com/c/go/+/189517
1 parent 3670dca commit 0483ff7

File tree

10 files changed

+36
-7
lines changed

10 files changed

+36
-7
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
language: go
2+
23
os:
34
- windows
45
- linux
56
- osx
7+
8+
branches:
9+
only:
10+
- master
11+
612
go:
713
- "1.11.x"
814
- "1.12.x"
15+
- "1.13beta1"
16+
917
env:
1018
- GO111MODULE=on
19+
1120
go_import_path: github.com/rogpeppe/go-internal
1221

1322
# Add this before_install until we have a definitive resolution on

cmd/testscript/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ func run(runDir, fileName string, verbose bool, envVars []string) error {
221221
addSetup(func(env *testscript.Env) error {
222222
// Add GOPROXY after calling the original setup
223223
// so that it overrides any GOPROXY set there.
224-
env.Vars = append(env.Vars, "GOPROXY="+srv.URL)
224+
env.Vars = append(env.Vars,
225+
"GOPROXY="+srv.URL,
226+
"GONOSUMDB=*",
227+
)
225228
return nil
226229
})
227230
}

cmd/testscript/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func TestScripts(t *testing.T) {
4747
Setup: func(env *testscript.Env) error {
4848
env.Vars = append(env.Vars,
4949
"GOINTERNALMODPATH="+filepath.Dir(gomod),
50+
"GONOSUMDB=*",
5051
)
5152
return nil
5253
},

cmd/testscript/testdata/env_var_with_go.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ unquote withproxy.txt
1313
testscript -v noproxy.txt
1414
stdout ^BANANA=$
1515
stdout '^GOPATH=\$WORK[/\\]gopath'$
16-
stdout ^GOPROXY=$
16+
[!go1.13] stdout ^GOPROXY=$
17+
[go1.13] stdout ^GOPROXY=https://proxy.golang.org,direct$
1718
! stderr .+
1819

1920
env BANANA=banana
@@ -25,7 +26,8 @@ env GOPROXY=
2526
testscript -v noproxy.txt
2627
stdout ^BANANA=$
2728
stdout '^GOPATH=\$WORK[/\\]gopath'$
28-
stdout ^GOPROXY=$
29+
[!go1.13] stdout ^GOPROXY=$
30+
[go1.13] stdout ^GOPROXY=https://proxy.golang.org,direct$
2931
! stderr .+
3032

3133
# no GOPROXY, no pass-through, with proxy

cmd/txtar-addmod/script_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ func TestScripts(t *testing.T) {
4242
p := testscript.Params{
4343
Dir: "testdata",
4444
Setup: func(e *testscript.Env) error {
45-
e.Vars = append(e.Vars, "GOPROXY="+proxyURL)
45+
e.Vars = append(e.Vars,
46+
"GOPROXY="+proxyURL,
47+
"GONOSUMDB=*",
48+
)
4649
return nil
4750
},
4851
}

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
module github.com/rogpeppe/go-internal
22

3+
go 1.11
4+
35
require gopkg.in/errgo.v2 v2.1.0

goproxytest/proxy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,13 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
193193

194194
a := srv.readArchive(path, vers)
195195
if a == nil {
196+
// As of https://go-review.googlesource.com/c/go/+/189517, cmd/go
197+
// resolves all paths. i.e. for github.com/hello/world, cmd/go attempts
198+
// to resolve github.com, github.com/hello and github.com/hello/world.
199+
// cmd/go expects a 404/410 response if there is nothing there. Hence we
200+
// cannot return with a 500.
196201
fmt.Fprintf(os.Stderr, "go proxy: no archive %s %s\n", path, vers)
197-
http.Error(w, "cannot load archive", 500)
202+
http.NotFound(w, r)
198203
return
199204
}
200205

goproxytest/proxy_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func TestScripts(t *testing.T) {
2323
Setup: func(e *testscript.Env) error {
2424
e.Vars = append(e.Vars,
2525
"GOPROXY="+srv.URL,
26+
"GONOSUMDB=*",
2627
)
2728
return nil
2829
},

goproxytest/testdata/list.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
go list -m -versions fruit.com
55
stdout 'v1.0.0 v1.1.0'
66

7-
8-
7+
8+
99

1010
-- go.mod --
1111
module mod

testscript/testscript_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func TestScripts(t *testing.T) {
109109
setupFilenames = append(setupFilenames, info.Name())
110110
}
111111
env.Values["somekey"] = 1234
112+
env.Vars = append(env.Vars,
113+
"GONOSUMDB=*",
114+
)
112115
return nil
113116
},
114117
})

0 commit comments

Comments
 (0)