-
Notifications
You must be signed in to change notification settings - Fork 367
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
Upgrade Go to 1.23 #6647
Upgrade Go to 1.23 #6647
Conversation
70aeff0
to
42bc9f8
Compare
* Update some for loops in response to the following change introduced in Go 1.22: each iteration of the loop creates new variables, to avoid accidental sharing bugs. As a result of this change, a few existing loop variables had become heap-allocated, so we updated the loop to avoid the extra allocation. Other loops that were affected by the change (compiling differently), but for which the loop variable was stack-allocated, were reviewed individually and when it made sense, the loop was refactored to avoid the extra variable copy. The `go test -gcflags=-d=loopvar=2` command was used to find affected loops. * The antrea/codegen image was updated to use Go 1.23. No changes in generated files. * golangci-lint was updated to the latest available version (v1.60.3) - govet reported some invalid usages of printf, which was addressed; this lead to some refactoring of the `antctl check` code - a new gosec rule (G115), which looks for potential integer overflows when converting between integer types, caused a lot of errors to be reported in the codebase. There were too many errors to be addressed as part of this PR, so we only handled a few of them for which the fix was straightforward. When the rule implementation is improved (so that it reports fewer false positives), we should review all errors and address them as needed. Fixes antrea-io#6644 Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
42bc9f8
to
304b2c4
Compare
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
pkg/antctl/raw/check/util.go
Outdated
@@ -216,13 +216,14 @@ func GenerateRandomNamespace(baseName string) string { | |||
} | |||
|
|||
func Teardown(ctx context.Context, client kubernetes.Interface, clusterName string, namespace string) { | |||
fmt.Fprintf(os.Stdout, fmt.Sprintf("[%s] ", clusterName)+"Deleting installation tests setup...\n") | |||
logger := NewLogger(fmt.Sprintf("[%s] ", clusterName)) |
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.
could we add a Logger
parameter to Teardown
and remove clusterName
?
pkg/antctl/raw/check/util.go
Outdated
@@ -233,8 +234,8 @@ func Teardown(ctx context.Context, client kubernetes.Interface, clusterName stri | |||
return false, nil | |||
}) | |||
if err != nil { | |||
fmt.Fprintf(os.Stdout, fmt.Sprintf("[%s] ", clusterName)+"Setup deletion failed\n") | |||
logger.Success("Setup deletion failed") |
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.
logger.Success("Setup deletion failed") | |
logger.Fail("Setup deletion failed") |
pkg/antctl/raw/check/util.go
Outdated
} else { | ||
fmt.Fprintf(os.Stdout, fmt.Sprintf("[%s] ", clusterName)+"Setup deletion successful\n") | ||
logger.Fail("Setup deletion successful") |
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.
logger.Fail("Setup deletion successful") | |
logger.Success("Setup deletion successful") |
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.
No new comments after quan's, LGTM overall
@@ -22,7 +22,7 @@ function echoerr { | |||
} | |||
|
|||
ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" | |||
IMAGE_NAME="antrea/codegen:kubernetes-1.29.2-build.2" | |||
IMAGE_NAME="antrea/codegen:kubernetes-1.29.2-build.3" |
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.
One question: I assume this image is already uploaded?
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.
Yes, I already pushed it
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
/test-all |
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.
LGTM
/test-all |
2 similar comments
/test-all |
/test-all |
/test-e2e |
/test-e2e |
Update some for loops in response to the following change introduced in Go 1.22: each iteration of the loop creates new variables, to avoid accidental sharing bugs. As a result of this change, a few existing loop variables had become heap-allocated, so we updated the loop to avoid the extra allocation. Other loops that were affected by the change (compiling differently), but for which the loop variable was stack-allocated, were reviewed individually and when it made sense, the loop was refactored to avoid the extra variable copy. The
go test -gcflags=-d=loopvar=2
command was used to find affected loops.The antrea/codegen image was updated to use Go 1.23. No changes in generated files.
golangci-lint was updated to the latest available version (v1.60.3)
antctl check
codeFixes #6644