From be8b1a06f44d1b8980d4c35b84a25f6323b8467b Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 11 Aug 2021 04:16:38 -0700 Subject: [PATCH] Use Go 1.16 for registry validator 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. 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. 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. 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. --- .github/workflows/assets/validate-registry/go.mod | 2 +- .github/workflows/assets/validate-registry/go.sum | 7 ------- .github/workflows/check-go-task.yml | 5 ++++- .github/workflows/check-registry.yml | 2 +- .github/workflows/test-go-integration-task.yml | 2 +- Taskfile.yml | 14 ++++++-------- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/assets/validate-registry/go.mod b/.github/workflows/assets/validate-registry/go.mod index 68793ac9..4112074a 100644 --- a/.github/workflows/assets/validate-registry/go.mod +++ b/.github/workflows/assets/validate-registry/go.mod @@ -1,5 +1,5 @@ module github.com/arduino/library-registry/.github/workflows/assets/validate-registry -go 1.14 +go 1.16 require github.com/arduino/libraries-repository-engine v0.0.0-20210715160651-710946ea85e3 diff --git a/.github/workflows/assets/validate-registry/go.sum b/.github/workflows/assets/validate-registry/go.sum index fda1281b..1bb7c672 100644 --- a/.github/workflows/assets/validate-registry/go.sum +++ b/.github/workflows/assets/validate-registry/go.sum @@ -1,5 +1,4 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= @@ -29,7 +28,6 @@ github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4l github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b/go.mod h1:uwGy5PpN4lqW97FiLnbcx+xx8jly5YuPMJWfVwwjJiQ= github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b h1:3PjgYG5gVPA7cipp7vIR2lF96KkEJIFBJ+ANnuv6J20= github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b/go.mod h1:iIPnclBMYm1g32Q5kXoqng4jLhMStReIP7ZxaoUC2y8= -github.com/arduino/golang-concurrent-workers v0.0.0-20170202182617-6710cdc954bc h1:PzGY1Ppud/Ng+LFHU16oOrWhYsnSLYurwiHlbVc/FJ0= github.com/arduino/golang-concurrent-workers v0.0.0-20170202182617-6710cdc954bc/go.mod h1:E+WBbLkFBdPp+N+yijgbdDI33mr5pm6j42RYLN5K4do= github.com/arduino/libraries-repository-engine v0.0.0-20210715160651-710946ea85e3 h1:kKFAwY80Dc6/F6nEXbuQWEZHkELwyvZmRQ2XIYVzAwQ= github.com/arduino/libraries-repository-engine v0.0.0-20210715160651-710946ea85e3/go.mod h1:xLHkMdw2PSqs1+qxS4G6eC4idKLXheLa6jDD/C/gsdw= @@ -68,7 +66,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fluxio/iohelpers v0.0.0-20160419043813-3a4dd67a94d2/go.mod h1:c7sGIpDbBo0JZZ1tKyC1p5smWf8QcUjK4bFtZjHAecg= github.com/fluxio/multierror v0.0.0-20160419044231-9c68d39025e5/go.mod h1:BEUDl7FG1cc76sM0J0x8dqr6RhiL4uqvk6oFkwuNyuM= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -114,7 +111,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -134,7 +130,6 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/clock v0.0.0-20180524022203-d293bb356ca4/go.mod h1:nD0vlnrUjcjJhqN5WuCWZyzfd5AHZAC9/ajvbSx69xA= github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= @@ -226,9 +221,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= diff --git a/.github/workflows/check-go-task.yml b/.github/workflows/check-go-task.yml index 29f9ffc0..23a3d6d3 100644 --- a/.github/workflows/check-go-task.yml +++ b/.github/workflows/check-go-task.yml @@ -3,7 +3,7 @@ name: Check Go env: # See: https://github.com/actions/setup-go/tree/v2#readme - GO_VERSION: "1.14" + GO_VERSION: "1.16" # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: @@ -88,6 +88,9 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x + - name: Install golint + run: go install golang.org/x/lint/golint@latest + - name: Check style run: task --silent go:lint diff --git a/.github/workflows/check-registry.yml b/.github/workflows/check-registry.yml index 2b19a2ab..7d3a420c 100644 --- a/.github/workflows/check-registry.yml +++ b/.github/workflows/check-registry.yml @@ -2,7 +2,7 @@ name: Check Registry Data File env: # See: https://github.com/actions/setup-go/tree/v2#readme - GO_VERSION: "1.14" + GO_VERSION: "1.16" # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index 877d41a8..256d8bf6 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -3,7 +3,7 @@ name: Test Integration env: # See: https://github.com/actions/setup-go/tree/v2#readme - GO_VERSION: "1.14" + GO_VERSION: "1.16" # See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python PYTHON_VERSION: "3.9" diff --git a/Taskfile.yml b/Taskfile.yml index 0da74482..017181ec 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -86,14 +86,12 @@ tasks: dir: "{{.GO_PROJECT_PATH}}" cmds: - | - PROJECT_PATH="$PWD" - # `go get` and `go list` commands must be run from a temporary folder to avoid polluting go.mod - cd "$(mktemp -d "${TMPDIR-${TMP-/tmp}}/task-temporary-XXXXX")" - go get golang.org/x/lint/golint - GOLINT_PATH="$(go list -f '{{"{{"}}.Target{{"}}"}}' golang.org/x/lint/golint || echo "false")" - # `golint` must be run from the module folder - cd "$PROJECT_PATH" - "$GOLINT_PATH" \ + if ! which golint &>/dev/null; then + echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation" + exit 1 + fi + - | + golint \ {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \ {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}