Skip to content

Commit 69e2dcc

Browse files
mvdanmpvl
authored andcommitted
cmd/cue: make long tests pass with Go 1.18
Go 1.18 no longer allows using "go get" to install programs, as that is now done via "go install" instead. We already updated the install instructions, but some of the tests still used "go get" that way. We require Go 1.16+, so we can assume "go install pkg@version" works. Also stop setting GO111MODULE=on in a couple of tests, as that has been the default since Go 1.16. Finally, since we require Go 1.16 or later, we can simplify the tests to no longer need to worry about older Go versions. Updates #1619. Change-Id: I59b16f3270b20e93efbab4b4044eb33c0ebc67c0 Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/536181 Unity-Result: CUEcueckoo <cueckoo@cuelang.org> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>
1 parent 6b138e4 commit 69e2dcc

File tree

6 files changed

+7
-55
lines changed

6 files changed

+7
-55
lines changed

cmd/cue/cmd/testdata/script/get_go_bad_embed.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Test that we get a sensible error message when there is a type
22
# checking error in the package that is being 'cue get go'-ed.
33

4-
[!go1.16] skip 'Only relevant for Go 1.16 and above'
54
[golang.org/issue/44287] skip
65

76
cue get go --local

cmd/cue/cmd/testdata/script/get_go_unresolvable_package.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Test that we get expected error when we ask cue get go to get
22
# a Go package that cannot be resolved.
33

4-
# Ensure that we don't automatically add the missing dependency pre Go 1.16
5-
[!go1.16] env GOFLAGS=-mod=readonly
6-
74
! cue get go k8s.io/api/apps/v1
8-
[go1.16] stderr '\Qno required module provides package k8s.io/api/apps/v1'
9-
[go1.14] [!go1.16] stderr '\Qcannot find module providing package k8s.io/api/apps/v1: import lookup disabled by -mod=readonly'
5+
stderr '\Qno required module provides package k8s.io/api/apps/v1'
106

117
-- go.mod --
128
module mod.com/blah
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# Test that we can install CUE via the pre Go 1.16 install
2-
# method (which should also work with Go 1.16) described in
3-
# the project README
1+
# Test that we can install CUE via the install method described in the project
2+
# README, which requires Go 1.16 or later.
43
#
54
# Keep this test in sync with all places that describe install
6-
# instructions
5+
# instructions.
76

87
[!long] skip 'Install tests use the network and take some time'
98

@@ -14,7 +13,6 @@ env GOPROXY=https://proxy.golang.org
1413
! exists $WORK/gopath/bin/cue
1514

1615
# Install
17-
env GO111MODULE=on
18-
go get cuelang.org/go/cmd/cue
16+
go install cuelang.org/go/cmd/cue@latest
1917
exec $WORK/gopath/bin/cue help
2018
stdout 'cue evaluates CUE files'

cmd/cue/cmd/testdata/script/install_contributing.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Test that we can install tools required to contribute to the CUE
2-
# project using the pre Go 1.16 install method (which should also
3-
# work with Go 1.16)
2+
# project via the new Go 1.16 method
43
#
54
# Keep this test in sync with all places that describe install
65
# instructions for contributing
@@ -14,7 +13,6 @@ env GOPROXY=https://proxy.golang.org
1413
! exists $WORK/gopath/bin/git-codereview
1514

1615
# Install
17-
env GO111MODULE=on
18-
go get golang.org/x/review/git-codereview
16+
go install golang.org/x/review/git-codereview@latest
1917
exec $WORK/gopath/bin/git-codereview help
2018
stdout 'Git-codereview is a git helper'

cmd/cue/cmd/testdata/script/install_contributing_go1.16.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

cmd/cue/cmd/testdata/script/install_go1.16.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)