From 243440774e77c88c6b7a1224666f1930f83975ad Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Thu, 2 Feb 2023 21:35:44 +0000 Subject: [PATCH] Add Go 1.20 support Swaps lint tooling from golint to golangci-lint. Resolve lint warnings for deprecated package io/ioutil. Adds Go strategy matrix for Go 1.18, 1.19, and 1.20. Update actions/setup-go package from v1 to v3 to resolve CI warnings. Signed-off-by: Austin Vazquez --- .github/workflows/build-pr.yml | 17 ++++++++++------- .github/workflows/build.yml | 17 ++++++++++------- Makefile | 20 +++++++------------- schema/validate.go | 4 ++-- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 73666d545..5d27ccffe 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -8,25 +8,28 @@ on: jobs: run: runs-on: ubuntu-latest + + strategy: + matrix: + go: [1.18.x, 1.19.x, 1.20.x] + steps: - name: checkout source code uses: actions/checkout@master + - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v3 with: - go-version: '1.17.2' + go-version: ${{ matrix.go }} + - name: run tests run: | export PATH="$(go env GOPATH)/bin:${PATH}" set -x make install.tools - # Fix for "cannot find main module" issue - go mod init github.com/opencontainers/runtime-spec - - go get -d ./schema/... make .govet - make .golint + make .lint make .gitvalidation make docs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9045dd4e2..17b32a88c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,25 +8,28 @@ on: jobs: run: runs-on: ubuntu-latest + + strategy: + matrix: + go: [1.18.x, 1.19.x, 1.20.x] + steps: - name: checkout source code uses: actions/checkout@master + - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v3 with: - go-version: '1.17.2' + go-version: ${{ matrix.go }} + - name: run tests run: | export PATH="$(go env GOPATH)/bin:${PATH}" set -x make install.tools - # Fix for "cannot find main module" issue - go mod init github.com/opencontainers/runtime-spec - - go get -d ./schema/... make .govet - make .golint + make .lint make .gitvalidation make docs diff --git a/Makefile b/Makefile index 7a61610db..1dfbac659 100644 --- a/Makefile +++ b/Makefile @@ -61,12 +61,9 @@ test: .govet .golint .gitvalidation .govet: go vet -x ./... -# `go get github.com/golang/lint/golint` -.golint: -ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true) - @which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false) - golint ./... -endif +.lint: + @which golangci-lint > /dev/null 2>/dev/null || (echo "ERROR: golangci-lint not found. Consider 'make install.tools' target" && false) + golangci-lint run # When this is running in GitHub, it will only check the GitHub commit range @@ -78,16 +75,13 @@ else git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD endif -install.tools: .install.golint .install.gitvalidation +install.tools: .install.lint .install.gitvalidation -# golint does not even build for