Skip to content

Commit

Permalink
Update Go to v1.19 (#99)
Browse files Browse the repository at this point in the history
To stay aligned with antrea-io/antrea

Most notables changes:
* we remove all uses of the io/ioutil package, which has been deprecated
* gofmt now reformats doc comments (e.g., lists inside comment blocks),
  which is why some comments have been reformatted automatically
* we now use the version of Go from the root go.mod file when setting up
  Go in Github workflows. This will reduce the number of changes we have
  to do in the future when updating Go.

Signed-off-by: Antonin Bas <abas@vmware.com>
  • Loading branch information
antoninbas authored Aug 25, 2022
1 parent 4770ff0 commit 79f07a5
Show file tree
Hide file tree
Showing 25 changed files with 159 additions and 413 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clair.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Scan Theia Docker image for vulnerabilities
run: |
mkdir clair-reports
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3
with:
# In order:
Expand Down Expand Up @@ -77,12 +77,12 @@ jobs:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3
with:
# In order:
Expand All @@ -106,12 +106,12 @@ jobs:
name: Check tidy and manifest
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Check tidy
run: make test-tidy
- name: Check manifest
Expand All @@ -123,12 +123,12 @@ jobs:
name: Verify docs and spelling
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run verify scripts
run: make verify
- name: Checking for broken Markdown links
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/golicense.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name != 'pull_request' }}
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Cache licensing information for dependencies
uses: actions/cache@v3
id: cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Theia images from previous jobs
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Install Kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/process_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Build assets
env:
TAG: ${{ github.ref }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
name: Verify docs and spelling
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run verify scripts
run: make verify
- name: Checking for broken Markdown links for main branch
Expand Down
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ linters-settings:
ignore-generated-header: false
severity: warning
confidence: 0.8
# errorf, var-declaration temporarily disabled because of https://github.com/golangci/golangci-lint/issues/2997
rules:
- name: unreachable-code
- name: errorf
# - name: errorf
- name: range
- name: superfluous-else
- name: var-declaration
# - name: var-declaration

linters:
disable-all: true
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DOCKER_ENV := \
-v $(DOCKER_CACHE)/gopath:/tmp/gopath \
-v $(DOCKER_CACHE)/gocache:/tmp/gocache \
-v $(CURDIR):/usr/src/antrea.io/theia \
golang:1.17
golang:1.19

.PHONY: docker-test-unit
docker-test-unit: $(DOCKER_CACHE)
Expand Down Expand Up @@ -98,7 +98,7 @@ fmt:

.golangci-bin:
@echo "===> Installing Golangci-lint <==="
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $@ v1.41.1
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $@ v1.48.0

.PHONY: golangci
golangci: .golangci-bin
Expand Down
2 changes: 1 addition & 1 deletion build/images/deps/go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17
1.19
2 changes: 1 addition & 1 deletion ci/clair-scan/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module antrea.io/theia/ci/clair

go 1.17
go 1.19

require (
github.com/aws/aws-sdk-go v1.30.23
Expand Down
2 changes: 1 addition & 1 deletion ci/golicense/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if [ "$#" -ne 2 ]; then
exit 1
fi

IMG=antrea/lichen
IMG=antrea/lichen:v0.1.7
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BINARIES_DIR="$( cd "$1" >/dev/null 2>&1 && pwd )"
REPORTS_DIR="$( cd "$2" >/dev/null 2>&1 && pwd )"
Expand Down
1 change: 0 additions & 1 deletion ci/jenkins/test-vmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ function run_e2e {

mkdir -p ${GIT_CHECKOUT_DIR}/theia-test-logs
go version
go mod tidy -compat=1.17

set +e
# HACK: see https://github.com/antrea-io/antrea/issues/2292
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module antrea.io/theia

go 1.17
go 1.19

require (
antrea.io/antrea v1.6.0
Expand Down
Loading

0 comments on commit 79f07a5

Please sign in to comment.