Skip to content

Commit

Permalink
Update Go to v1.19
Browse files Browse the repository at this point in the history
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
* the codegen image has been updated to kubernetes-1.24.0-build.1 to
  include the updated version of Go. "go get: no longer builds or
  installs packages in module-aware mode, so "go get" has been replaced
  with "go install" in the Dockerfile.
* 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.
* running "go mod tidy" with the updated Go version seems to have
  removed some stale entries from go.sum files.

Fixes antrea-io#4105

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas committed Aug 11, 2022
1 parent 173ef52 commit 05b84b8
Show file tree
Hide file tree
Showing 93 changed files with 423 additions and 723 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
name: GoBenchmark
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 into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Install benchci
run: curl -sfL https://raw.githubusercontent.com/antrea-io/benchci/main/install.sh | sudo sh -s -- -b /usr/local/bin

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clair.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Scan Antrea Docker image for vulnerabilities
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_SES }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ jobs:
if: ${{ github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies') && contains(github.event.pull_request.labels.*.name, 'go') }}
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v3
with:
# Check out the pull request HEAD
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.ANTREA_BOT_WRITE_PAT }}
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run go mod tidy
# the checks above (Github actor and PR labels) ensure that a malicious
# actor cannot open a PR with a modified "tidy" Makefile target and
Expand Down
80 changes: 40 additions & 40 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
name: Unit test (ubuntu-latest)
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'
- uses: actions/cache@v3
with:
# In order:
Expand Down Expand Up @@ -74,12 +74,12 @@ jobs:
name: Unit test (windows-2019)
runs-on: [windows-2019]
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'
- uses: actions/cache@v3
with:
# In order:
Expand Down Expand Up @@ -110,12 +110,12 @@ jobs:
name: Integration test
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'
- uses: actions/cache@v3
with:
# In order:
Expand Down Expand Up @@ -155,12 +155,12 @@ jobs:
name: Golangci-lint (ubuntu-latest)
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'
- uses: actions/cache@v3
with:
# In order:
Expand All @@ -187,12 +187,12 @@ jobs:
name: Golangci-lint (macos-latest)
runs-on: [macos-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'
- uses: actions/cache@v3
with:
# In order:
Expand All @@ -219,12 +219,12 @@ jobs:
name: Build Antrea and antctl binaries
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'
- uses: actions/cache@v3
with:
# In order:
Expand Down Expand Up @@ -258,12 +258,12 @@ jobs:
name: Build Antrea Windows binaries
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'
- uses: actions/cache@v3
with:
# In order:
Expand All @@ -287,12 +287,12 @@ jobs:
name: Check tidy, code generation and manifest
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'
# tidy check need to be run before code generation which will regenerate codes.
- name: Check tidy
run: make test-tidy
Expand All @@ -307,12 +307,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
Expand Down Expand Up @@ -343,11 +343,11 @@ jobs:
name: Go benchmark test
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 Go benchmark test
run: go test -run '^$' -bench . -benchtime 1x -timeout 10m -cpu 4 -v -benchmem ./pkg/...
6 changes: 3 additions & 3 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/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v3
go-version-file: 'go.mod'
- name: Cache licensing information for dependencies
uses: actions/cache@v3
id: cache
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -253,7 +253,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -369,7 +369,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -434,7 +434,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -477,7 +477,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -520,7 +520,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -563,7 +563,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -606,7 +606,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -641,7 +641,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version-file: 'go.mod'
- name: Download Antrea image from previous job
uses: actions/download-artifact@v3
with:
Expand Down
6 changes: 3 additions & 3 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/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v3
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ the `$GOPATH`.

To develop locally, you can follow these steps:

1. [Install Go 1.17](https://golang.org/doc/install)
1. [Install Go 1.19](https://golang.org/doc/install)
2. Checkout your feature branch and `cd` into it.
3. To build all Go files and install them under `bin`, run `make bin`
4. To run all Go unit tests, run `make test-unit`
Expand Down
Loading

0 comments on commit 05b84b8

Please sign in to comment.