Skip to content

Commit

Permalink
ci: changes for go1.13beta1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
myitcv authored and mvdan committed Aug 27, 2019
1 parent 3670dca commit 0483ff7
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
language: go

os:
- windows
- linux
- osx

branches:
only:
- master

go:
- "1.11.x"
- "1.12.x"
- "1.13beta1"

env:
- GO111MODULE=on

go_import_path: github.com/rogpeppe/go-internal

# Add this before_install until we have a definitive resolution on
Expand Down
5 changes: 4 additions & 1 deletion cmd/testscript/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ func run(runDir, fileName string, verbose bool, envVars []string) error {
addSetup(func(env *testscript.Env) error {
// Add GOPROXY after calling the original setup
// so that it overrides any GOPROXY set there.
env.Vars = append(env.Vars, "GOPROXY="+srv.URL)
env.Vars = append(env.Vars,
"GOPROXY="+srv.URL,
"GONOSUMDB=*",
)
return nil
})
}
Expand Down
1 change: 1 addition & 0 deletions cmd/testscript/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestScripts(t *testing.T) {
Setup: func(env *testscript.Env) error {
env.Vars = append(env.Vars,
"GOINTERNALMODPATH="+filepath.Dir(gomod),
"GONOSUMDB=*",
)
return nil
},
Expand Down
6 changes: 4 additions & 2 deletions cmd/testscript/testdata/env_var_with_go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ unquote withproxy.txt
testscript -v noproxy.txt
stdout ^BANANA=$
stdout '^GOPATH=\$WORK[/\\]gopath'$
stdout ^GOPROXY=$
[!go1.13] stdout ^GOPROXY=$
[go1.13] stdout ^GOPROXY=https://proxy.golang.org,direct$
! stderr .+

env BANANA=banana
Expand All @@ -25,7 +26,8 @@ env GOPROXY=
testscript -v noproxy.txt
stdout ^BANANA=$
stdout '^GOPATH=\$WORK[/\\]gopath'$
stdout ^GOPROXY=$
[!go1.13] stdout ^GOPROXY=$
[go1.13] stdout ^GOPROXY=https://proxy.golang.org,direct$
! stderr .+

# no GOPROXY, no pass-through, with proxy
Expand Down
5 changes: 4 additions & 1 deletion cmd/txtar-addmod/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ func TestScripts(t *testing.T) {
p := testscript.Params{
Dir: "testdata",
Setup: func(e *testscript.Env) error {
e.Vars = append(e.Vars, "GOPROXY="+proxyURL)
e.Vars = append(e.Vars,
"GOPROXY="+proxyURL,
"GONOSUMDB=*",
)
return nil
},
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/rogpeppe/go-internal

go 1.11

require gopkg.in/errgo.v2 v2.1.0
7 changes: 6 additions & 1 deletion goproxytest/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {

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

Expand Down
1 change: 1 addition & 0 deletions goproxytest/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestScripts(t *testing.T) {
Setup: func(e *testscript.Env) error {
e.Vars = append(e.Vars,
"GOPROXY="+srv.URL,
"GONOSUMDB=*",
)
return nil
},
Expand Down
4 changes: 2 additions & 2 deletions goproxytest/testdata/list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
go list -m -versions fruit.com
stdout 'v1.0.0 v1.1.0'

go get -m fruit.com@v1.0.0
go get -m fruit.com@v1.1.0
go get -d fruit.com@v1.0.0
go get -d fruit.com@v1.1.0

-- go.mod --
module mod
Expand Down
3 changes: 3 additions & 0 deletions testscript/testscript_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func TestScripts(t *testing.T) {
setupFilenames = append(setupFilenames, info.Name())
}
env.Values["somekey"] = 1234
env.Vars = append(env.Vars,
"GONOSUMDB=*",
)
return nil
},
})
Expand Down

0 comments on commit 0483ff7

Please sign in to comment.