-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NET-4968] Upgrade Go to 1.21 #20062
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
Upgrade to use Go 1.21.6. | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -408,17 +408,19 @@ jobs: | |
consul-license: ${{secrets.CONSUL_LICENSE}} | ||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}" | ||
|
||
go-test-api-1-19: | ||
go-test-api-backwards-compatibility: | ||
name: go-test-api-${{ needs.get-go-version.outputs.go-version-previous }} | ||
Comment on lines
-411
to
+412
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
needs: | ||
- setup | ||
- get-go-version | ||
- dev-build | ||
uses: ./.github/workflows/reusable-unit.yml | ||
with: | ||
directory: api | ||
runs-on: ${{ needs.setup.outputs.compute-large }} | ||
repository-name: ${{ github.repository }} | ||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}" | ||
go-version: "1.19" | ||
go-version: ${{ needs.get-go-version.outputs.go-version-previous }} | ||
permissions: | ||
id-token: write # NOTE: this permission is explicitly required for Vault auth. | ||
contents: read | ||
|
@@ -427,17 +429,18 @@ jobs: | |
consul-license: ${{secrets.CONSUL_LICENSE}} | ||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}" | ||
|
||
go-test-api-1-20: | ||
go-test-api: | ||
needs: | ||
- setup | ||
- get-go-version | ||
- dev-build | ||
uses: ./.github/workflows/reusable-unit.yml | ||
with: | ||
directory: api | ||
runs-on: ${{ needs.setup.outputs.compute-large }} | ||
repository-name: ${{ github.repository }} | ||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}" | ||
go-version: "1.20" | ||
go-version: ${{ needs.get-go-version.outputs.go-version }} | ||
permissions: | ||
id-token: write # NOTE: this permission is explicitly required for Vault auth. | ||
contents: read | ||
|
@@ -446,17 +449,19 @@ jobs: | |
consul-license: ${{secrets.CONSUL_LICENSE}} | ||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}" | ||
|
||
go-test-sdk-1-19: | ||
go-test-sdk-backwards-compatibility: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I love this. No more twiddling versions whenever we update the go major version. |
||
name: go-test-sdk-${{ needs.get-go-version.outputs.go-version-previous }} | ||
needs: | ||
- setup | ||
- get-go-version | ||
- dev-build | ||
uses: ./.github/workflows/reusable-unit.yml | ||
with: | ||
directory: sdk | ||
runs-on: ${{ needs.setup.outputs.compute-large }} | ||
repository-name: ${{ github.repository }} | ||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}" | ||
go-version: "1.19" | ||
go-version: ${{ needs.get-go-version.outputs.go-version-previous }} | ||
permissions: | ||
id-token: write # NOTE: this permission is explicitly required for Vault auth. | ||
contents: read | ||
|
@@ -465,17 +470,18 @@ jobs: | |
consul-license: ${{secrets.CONSUL_LICENSE}} | ||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}" | ||
|
||
go-test-sdk-1-20: | ||
go-test-sdk: | ||
needs: | ||
- setup | ||
- get-go-version | ||
- dev-build | ||
uses: ./.github/workflows/reusable-unit.yml | ||
with: | ||
directory: sdk | ||
runs-on: ${{ needs.setup.outputs.compute-large }} | ||
repository-name: ${{ github.repository }} | ||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}" | ||
go-version: "1.20" | ||
go-version: ${{ needs.get-go-version.outputs.go-version }} | ||
permissions: | ||
id-token: write # NOTE: this permission is explicitly required for Vault auth. | ||
contents: read | ||
|
@@ -521,10 +527,10 @@ jobs: | |
- go-test-race | ||
- go-test-envoyextensions | ||
- go-test-troubleshoot | ||
- go-test-api-1-19 | ||
- go-test-api-1-20 | ||
- go-test-sdk-1-19 | ||
- go-test-sdk-1-20 | ||
- go-test-api-backwards-compatibility | ||
- go-test-api | ||
- go-test-sdk-backwards-compatibility | ||
- go-test-sdk | ||
- go-test-32bit | ||
# - go-test-s390x | ||
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.20.12 | ||
1.21.6 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,18 +98,14 @@ linters-settings: | |
- google.golang.org/protobuf | ||
|
||
depguard: | ||
list-type: denylist | ||
include-go-root: true | ||
# A list of packages for the list type specified. | ||
# Default: [] | ||
packages: | ||
- net/rpc | ||
# A list of packages for the list type specified. | ||
# Specify an error message to output when a denied package is used. | ||
# Default: [] | ||
packages-with-error-message: | ||
- net/rpc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc" | ||
- github.com/golang/protobuf: "only use google.golang.org/protobuf" | ||
rules: | ||
main: | ||
listMode: lax | ||
deny: | ||
- pkg: net/rpc | ||
desc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc" | ||
- pkg: github.com/golang/protobuf | ||
desc: "only use google.golang.org/protobuf" | ||
Comment on lines
-101
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See golangci/golangci-lint#3906. Some other projects disabled this linter or replaced w/ another tool like Semgrep in response, but since we use custom rules and don't yet use Semgrep, I tried to adapt ours in-place. |
||
|
||
run: | ||
timeout: 10m | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ GO_MODULES := $(shell find . -name go.mod -exec dirname {} \; | grep -v "proto-g | |
# These version variables can either be a valid string for "go install <module>@<version>" | ||
# or the string @DEV to imply use what is currently installed locally. | ||
### | ||
GOLANGCI_LINT_VERSION='v1.51.1' | ||
GOLANGCI_LINT_VERSION='v1.55.2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed for compatibility w/ Go 1.21 |
||
MOCKERY_VERSION='v2.37.1' | ||
BUF_VERSION='v1.26.0' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,7 @@ func destinationRulesByPort(allPorts []string, destinationRules []*pbauth.Destin | |
return out | ||
} | ||
|
||
//nolint:unparam | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious but why was this necessary. AFAICT allPorts and dr are both used in the function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is the linter even smarter and figuring out that one of the two is always nil based on other code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the latter - that was my best explanation for why it suddenly started failing on the linter upgrade (same question you asked led me to notice the same) |
||
func convertDestinationRule(allPorts []string, dr *pbauth.DestinationRule) ([]string, DestinationRule) { | ||
ports := make(map[string]struct{}) | ||
if len(dr.PortNames) > 0 { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@curtbushko FYI for K8s + DP bumps, we got 1.21.6 earlier this week