Skip to content

Commit

Permalink
all: drop support for Go 1.16.x
Browse files Browse the repository at this point in the history
Now that Go 1.18 has been out for a couple of months,
we can go ahead and drop the now-unsupported Go 1.16.x.
This is also important for keeping our dependencies up to date,
as a few of them like github.com/protocolbuffers/txtpbfmt
have already started to use std APIs added in Go 1.17.

Note that we also switch CI to run `go generate` with the latest stable
Go version we test on, 1.18.x, rather than the oldest,
which will now be 1.17.x rather than 1.16.x.

Using the oldest used to be an important detail,
as `go generate` would automatically run the qgo tool,
which would then copy code from Go's standard library.
Since CL 536072, that step is now manual, so CI is no longer involved.

Using the newest stable Go version is also more consistent,
as the majority of the developers working on CUE will use that version,
so that is the version they will run `go generate` with.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Id6c1b7d12dead62be2ba4612eca24ba756e4bdd3
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/537704
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Paul Jolly <paul@myitcv.io>
  • Loading branch information
mvdan committed May 5, 2022
1 parent a58ac53 commit bd9ae53
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 48 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
fail-fast: false
matrix:
go-version:
- 1.16.x
- 1.17.x
- 1.18.x
os:
Expand Down Expand Up @@ -84,7 +83,7 @@ jobs:
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- if: ${{ github.ref == 'refs/heads/master' }}
run: echo CUE_LONG=true >> $GITHUB_ENV
- if: matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-20.04'
- if: matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-20.04'
name: Generate
run: go generate ./...
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[![Go Reference](https://pkg.go.dev/badge/cuelang.org/go.svg)](https://pkg.go.dev/cuelang.org/go)
[![Github](https://github.com/cue-lang/cue/workflows/Test/badge.svg)](https://github.com/cue-lang/cue/actions)
[![GolangCI](https://golangci.com/badges/github.com/cue-lang/cue.svg)](https://golangci.com/r/github.com/cue-lang/cue)
[![Go 1.16+](https://img.shields.io/badge/go-1.16-9cf.svg)](https://golang.org/dl/)
[![Go 1.17+](https://img.shields.io/badge/go-1.17-9cf.svg)](https://golang.org/dl/)
[![platforms](https://img.shields.io/badge/platforms-linux|windows|macos-inactive.svg)]()

# The CUE Data Constraint Language
Expand Down
13 changes: 3 additions & 10 deletions cmd/cue/cmd/testdata/script/cmd_github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ jobs:
fail-fast: false
matrix:
go-version:
- 1.16.x
- 1.17.x
- 1.18.x
os:
Expand Down Expand Up @@ -210,7 +209,7 @@ jobs:
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- if: ${{ github.ref == 'refs/heads/master' }}
run: echo CUE_LONG=true >> $GITHUB_ENV
- if: matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-20.04'
- if: matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-20.04'
name: Generate
run: go generate ./...
- name: Test
Expand Down Expand Up @@ -1335,12 +1334,6 @@ _#step: ((_#job & {
steps: _
}).steps & [_])[0]

// We use the oldest supported Go version for code generation.
// TODO(mvdan): now that we don't use qgo via go:generate,
// we should try to use latestStableGo for code generation,
// which is closer to how developers will run go generate.
_#codeGenGo: "1.16.x"

// Use the latest Go version for extra checks,
// such as running tests with the data race detector.
_#latestStableGo: "1.18.x"
Expand All @@ -1355,7 +1348,7 @@ _#windowsMachine: "windows-2022"
_#testStrategy: {
"fail-fast": false
matrix: {
"go-version": [_#codeGenGo, "1.17.x", _#latestStableGo]
"go-version": ["1.17.x", _#latestStableGo]
os: [_#linuxMachine, _#macosMachine, _#windowsMachine]
}
}
Expand Down Expand Up @@ -1404,7 +1397,7 @@ _#goGenerate: _#step & {
run: "go generate ./..."
// The Go version corresponds to the precise version specified in
// the matrix. Skip windows for now until we work out why re-gen is flaky
if: "matrix.go-version == '\(_#codeGenGo)' && matrix.os == '\(_#linuxMachine)'"
if: "matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)'"
}
_#goTest: _#step & {
name: "Test"
Expand Down
36 changes: 12 additions & 24 deletions cue/testdata/eval/github.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,6 @@ _#step: ((_#job & {
steps: _
}).steps & [_])[0]

// We use the oldest supported Go version for code generation.
// TODO(mvdan): now that we don't use qgo via go:generate,
// we should try to use latestStableGo for code generation,
// which is closer to how developers will run go generate.
_#codeGenGo: "1.16.x"

// Use the latest Go version for extra checks,
// such as running tests with the data race detector.
_#latestStableGo: "1.18.x"
Expand All @@ -270,7 +264,7 @@ _#windowsMachine: "windows-2022"
_#testStrategy: {
"fail-fast": false
matrix: {
"go-version": [_#codeGenGo, "1.17.x", _#latestStableGo]
"go-version": ["1.17.x", _#latestStableGo]
os: [_#linuxMachine, _#macosMachine, _#windowsMachine]
}
}
Expand Down Expand Up @@ -319,7 +313,7 @@ _#goGenerate: _#step & {
run: "go generate ./..."
// The Go version corresponds to the precise version specified in
// the matrix. Skip windows for now until we work out why re-gen is flaky
if: "matrix.go-version == '\(_#codeGenGo)' && matrix.os == '\(_#linuxMachine)'"
if: "matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)'"
}
_#goTest: _#step & {
name: "Test"
Expand Down Expand Up @@ -1105,9 +1099,8 @@ import "strings"
"fail-fast": (bool){ false }
matrix: (#struct){
"go-version": (#list){
0: (string){ "1.16.x" }
1: (string){ "1.17.x" }
2: (string){ "1.18.x" }
0: (string){ "1.17.x" }
1: (string){ "1.18.x" }
}
os: (#list){
0: (string){ "ubuntu-20.04" }
Expand Down Expand Up @@ -1154,7 +1147,7 @@ import "strings"
6: (#struct){
name: (string){ "Generate" }
run: (string){ "go generate ./..." }
if: (string){ "matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-20.04'" }
if: (string){ "matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-20.04'" }
}
7: (#struct){
name: (string){ "Test" }
Expand Down Expand Up @@ -1627,9 +1620,8 @@ import "strings"
"fail-fast": (bool){ false }
matrix: (#struct){
"go-version": (#list){
0: (string){ "1.16.x" }
1: (string){ "1.17.x" }
2: (string){ "1.18.x" }
0: (string){ "1.17.x" }
1: (string){ "1.18.x" }
}
os: (#list){
0: (string){ "ubuntu-20.04" }
Expand Down Expand Up @@ -1676,7 +1668,7 @@ import "strings"
6: (#struct){
name: (string){ "Generate" }
run: (string){ "go generate ./..." }
if: (string){ "matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-20.04'" }
if: (string){ "matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-20.04'" }
}
7: (#struct){
name: (string){ "Test" }
Expand Down Expand Up @@ -2139,7 +2131,6 @@ import "strings"
}
_#step(:ci): (#struct){
}
_#codeGenGo(:ci): (string){ "1.16.x" }
_#latestStableGo(:ci): (string){ "1.18.x" }
_#pinnedReleaseGo(:ci): (string){ "1.18.1" }
_#linuxMachine(:ci): (string){ "ubuntu-20.04" }
Expand All @@ -2149,9 +2140,8 @@ import "strings"
"fail-fast": (bool){ false }
matrix: (#struct){
"go-version": (#list){
0: (string){ "1.16.x" }
1: (string){ "1.17.x" }
2: (string){ "1.18.x" }
0: (string){ "1.17.x" }
1: (string){ "1.18.x" }
}
os: (#list){
0: (string){ "ubuntu-20.04" }
Expand Down Expand Up @@ -2188,7 +2178,7 @@ import "strings"
_#goGenerate(:ci): (#struct){
name: (string){ "Generate" }
run: (string){ "go generate ./..." }
if: (string){ "matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-20.04'" }
if: (string){ "matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-20.04'" }
}
_#goTest(:ci): (#struct){
name: (string){ "Test" }
Expand Down Expand Up @@ -2522,7 +2512,6 @@ import "strings"
}).steps & [
_,
])[0]
_#codeGenGo: "1.16.x"
_#latestStableGo: "1.18.x"
_#pinnedReleaseGo: "1.18.1"
_#linuxMachine: "ubuntu-20.04"
Expand All @@ -2532,7 +2521,6 @@ import "strings"
"fail-fast": false
matrix: {
"go-version": [
〈3;_#codeGenGo〉,
"1.17.x",
〈3;_#latestStableGo〉,
]
Expand Down Expand Up @@ -2571,7 +2559,7 @@ import "strings"
_#goGenerate: (〈0;_#step〉 & {
name: "Generate"
run: "go generate ./..."
if: "matrix.go-version == '\(〈1;_#codeGenGo〉)' && matrix.os == '\(〈1;_#linuxMachine〉)'"
if: "matrix.go-version == '\(〈1;_#latestStableGo〉)' && matrix.os == '\(〈1;_#linuxMachine〉)'"
})
_#goTest: (〈0;_#step〉 & {
name: "Test"
Expand Down
2 changes: 1 addition & 1 deletion doc/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ href="mailto:security@cuelang.org">security@cuelang.org</a>.
The code contribution process used by the CUE project is a little different from
that used by other open source projects. We assume you have a basic
understanding of [`git`](https://git-scm.com/) and [Go](https://golang.org)
(1.16 or later).
(1.17 or later).

The first thing to decide is whether you want to contribute a code change via
GitHub or GerritHub. Both workflows are fully supported, and whilst GerritHub is
Expand Down
4 changes: 2 additions & 2 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Currently CUE can only be installed from source.

### Prerequisites

Go 1.16 or higher (see below)
Go 1.17 or higher (see below)

### Installing CUE

Expand All @@ -18,7 +18,7 @@ To download and install the `cue` command line tool run
go install cuelang.org/go/cmd/cue@latest
```

If the command fails, make sure your version of Go is 1.16 or later.
If the command fails, make sure your version of Go is 1.17 or later.

And make sure the install directory is in your path.

Expand Down
10 changes: 2 additions & 8 deletions internal/ci/workflows.cue
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ _#bashWorkflow: json.#Workflow & {
_#job: ((json.#Workflow & {}).jobs & {x: _}).x
_#step: ((_#job & {steps: _}).steps & [_])[0]

// We use the oldest supported Go version for code generation.
// TODO(mvdan): now that we don't use qgo via go:generate,
// we should try to use latestStableGo for code generation,
// which is closer to how developers will run go generate.
_#codeGenGo: "1.16.x"

// Use the latest Go version for extra checks,
// such as running tests with the data race detector.
_#latestStableGo: "1.18.x"
Expand All @@ -349,7 +343,7 @@ _#windowsMachine: "windows-2022"
_#testStrategy: {
"fail-fast": false
matrix: {
"go-version": [_#codeGenGo, "1.17.x", _#latestStableGo]
"go-version": ["1.17.x", _#latestStableGo]
os: [_#linuxMachine, _#macosMachine, _#windowsMachine]
}
}
Expand Down Expand Up @@ -405,7 +399,7 @@ _#goGenerate: _#step & {
run: "go generate ./..."
// The Go version corresponds to the precise version specified in
// the matrix. Skip windows for now until we work out why re-gen is flaky
if: "matrix.go-version == '\(_#codeGenGo)' && matrix.os == '\(_#linuxMachine)'"
if: "matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)'"
}

_#goTest: _#step & {
Expand Down

0 comments on commit bd9ae53

Please sign in to comment.