Skip to content

Commit fe94c5a

Browse files
committed
Update to Go 1.16
1.16 is now the preferred Go version for all Arduino tooling projects. The update from Go 1.14 to 1.16 broke the task that runs golint: ``` $ go mod tidy && task --silent go:lint no required module provides package golang.org/x/lint/golint: go.mod file not found in current directory or any parent directory; see 'go help modules' task: Failed to run task "go:lint": exit status 1 ``` The good news is that the new `go install` command eliminates the need for the workaround of running the `go get golang.org/x/lint/golint` command from outside the project path in order to avoid pollution of `go.sum`. The bad news is the `go list` command used to get the path of the golint installation does not work in the "module-aware mode" that is now the default (and will be the only mode in Go 1.17). In the end, I gave up on making the task work as before. I think it's better to require the user to install golint and put the installation in the system `PATH`, displaying a helpful message when this has not been done.
1 parent f589aff commit fe94c5a

File tree

7 files changed

+14
-19
lines changed

7 files changed

+14
-19
lines changed

.github/workflows/check-go-task.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check Go
22

33
env:
44
# See: https://github.com/actions/setup-go/tree/v2#readme
5-
GO_VERSION: "1.14"
5+
GO_VERSION: "1.16"
66

77
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
88
on:
@@ -90,6 +90,9 @@ jobs:
9090
repo-token: ${{ secrets.GITHUB_TOKEN }}
9191
version: 3.x
9292

93+
- name: Install golint
94+
run: go install golang.org/x/lint/golint@latest
95+
9396
- name: Check style
9497
run: task --silent go:lint
9598

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Create Release
22

33
env:
44
# See: https://github.com/actions/setup-go/tree/v2#readme
5-
GO_VERSION: "1.14"
5+
GO_VERSION: "1.16"
66

77
on:
88
push:

.github/workflows/test-go-integration-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test Integration
33

44
env:
55
# See: https://github.com/actions/setup-go/tree/v2#readme
6-
GO_VERSION: "1.14"
6+
GO_VERSION: "1.16"
77
# See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
88
PYTHON_VERSION: "3.9"
99

.github/workflows/test-go-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test Go
33

44
env:
55
# See: https://github.com/actions/setup-go/tree/v2#readme
6-
GO_VERSION: "1.14"
6+
GO_VERSION: "1.16"
77

88
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
99
on:

Taskfile.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,12 @@ tasks:
7272
desc: Lint Go code
7373
cmds:
7474
- |
75-
PROJECT_PATH="$PWD"
76-
# `go get` and `go list` commands must be run from a temporary folder to avoid polluting go.mod
77-
cd "$(mktemp -d "${TMPDIR-${TMP-/tmp}}/task-temporary-XXXXX")"
78-
go get golang.org/x/lint/golint
79-
GOLINT_PATH="$(go list -f '{{"{{"}}.Target{{"}}"}}' golang.org/x/lint/golint || echo "false")"
80-
# `golint` must be run from the module folder
81-
cd "$PROJECT_PATH"
82-
"$GOLINT_PATH" \
75+
if ! which golint &>/dev/null; then
76+
echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation"
77+
exit 1
78+
fi
79+
- |
80+
golint \
8381
{{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
8482
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
8583

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/arduino/libraries-repository-engine
22

3-
go 1.14
3+
go 1.16
44

55
require (
66
github.com/arduino/arduino-cli v0.0.0-20210520100059-2666b6ec51e9

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2-
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
32
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
43
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
54
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
@@ -66,7 +65,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
6665
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
6766
github.com/fluxio/iohelpers v0.0.0-20160419043813-3a4dd67a94d2/go.mod h1:c7sGIpDbBo0JZZ1tKyC1p5smWf8QcUjK4bFtZjHAecg=
6867
github.com/fluxio/multierror v0.0.0-20160419044231-9c68d39025e5/go.mod h1:BEUDl7FG1cc76sM0J0x8dqr6RhiL4uqvk6oFkwuNyuM=
69-
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
7068
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
7169
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
7270
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -112,7 +110,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
112110
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
113111
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
114112
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
115-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
116113
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
117114
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
118115
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
@@ -132,7 +129,6 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i
132129
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
133130
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
134131
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
135-
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
136132
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
137133
github.com/juju/clock v0.0.0-20180524022203-d293bb356ca4/go.mod h1:nD0vlnrUjcjJhqN5WuCWZyzfd5AHZAC9/ajvbSx69xA=
138134
github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
@@ -224,9 +220,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
224220
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
225221
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
226222
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
227-
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
228223
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
229-
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
230224
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
231225
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
232226
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=

0 commit comments

Comments
 (0)