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
treewide: Ensure that binaries are built with at least Go 1.17 #17322
Conversation
The bug that triggered this PR was I ran $ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean $ make
contrib/scripts/check-logging-subsys-field.sh
contrib/scripts/check-fmt.sh
Unformatted Go source code:
./Documentation/_api/v1/models/zz_generated.deepequal.go
diff -u ./Documentation/_api/v1/models/zz_generated.deepequal.go.orig ./Documentation/_api/v1/models/zz_generated.deepequal.go
--- ./Documentation/_api/v1/models/zz_generated.deepequal.go.orig 2021-09-06 15:10:13.546643942 +0200
+++ ./Documentation/_api/v1/models/zz_generated.deepequal.go 2021-09-06 15:10:13.546643942 +0200
@@ -1,3 +1,4 @@
+//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2017-2021 Authors of Cilium
./Documentation/_api/v1/models/zz_generated.deepcopy.go
diff -u ./Documentation/_api/v1/models/zz_generated.deepcopy.go.orig ./Documentation/_api/v1/models/zz_generated.deepcopy.go
--- ./Documentation/_api/v1/models/zz_generated.deepcopy.go.orig 2021-09-06 15:10:13.554643998 +0200
+++ ./Documentation/_api/v1/models/zz_generated.deepcopy.go 2021-09-06 15:10:13.554643998 +0200
@@ -1,3 +1,4 @@
+//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2017-2021 Authors of Cilium
./Documentation/_api/api/v1/models/zz_generated.deepequal.go
diff -u ./Documentation/_api/api/v1/models/zz_generated.deepequal.go.orig ./Documentation/_api/api/v1/models/zz_generated.deepequal.go
--- ./Documentation/_api/api/v1/models/zz_generated.deepequal.go.orig 2021-09-06 15:10:13.742645311 +0200
+++ ./Documentation/_api/api/v1/models/zz_generated.deepequal.go 2021-09-06 15:10:13.742645311 +0200
@@ -1,3 +1,4 @@
+//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2017-2021 Authors of Cilium
./Documentation/_api/api/v1/models/zz_generated.deepcopy.go
diff -u ./Documentation/_api/api/v1/models/zz_generated.deepcopy.go.orig ./Documentation/_api/api/v1/models/zz_generated.deepcopy.go
--- ./Documentation/_api/api/v1/models/zz_generated.deepcopy.go.orig 2021-09-06 15:10:13.750645368 +0200
+++ ./Documentation/_api/api/v1/models/zz_generated.deepcopy.go 2021-09-06 15:10:13.750645368 +0200
@@ -1,3 +1,4 @@
+//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2017-2021 Authors of Cilium
make: *** [Makefile:507: precheck] Error 1 Refs #17190 and specifically this comment:
|
Note that these early checks should also help shake out cases where out test infrastructure is using an older version of Go. |
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.
Would be nice to update the make update-go-version
target as well to update these //go:build
lines based on the Go version specified in GO_VERSION
.
FWIW, christarazi/controller-tools#1 should take care of updating our forked version of controller-tools to generate |
Great idea, done. |
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.
Looks pretty good, one comment on making the discovery of main.go files more dynamic. Not sure if it over-searches tho.
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, pending Louis's suggestion.
ConformanceKind1.19 failure is #16938. |
test-me-please Job 'Cilium-PR-K8s-GKE' failed and has not been observed before, so may be related to your PR: Click to show.Test Name
Failure Output
If it is a flake, comment Job 'Cilium-PR-K8s-1.16-net-next' failed and has not been observed before, so may be related to your PR: Click to show.Test Name
Failure Output
If it is a flake, comment |
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.
sed -i
is not portable, but it seems we already use it in several places so let it be.
test-me-please |
This needs #17391 and a rebase before the tests will pass as the current Vagrant box images have Go 1.16. |
Cilium relies on a number of Go features that are not covered by Go's backward compatibility guarantee, for example: * //go:embed (available since Go 1.16) * //go:build (available since Go 1.17) There may be other cases where, for example, we rely on bug fixes in the standard library. Building Cilium with an earlier version of Go may complete without error, but there is no guarantee that the binary will behave correctly. This PR adds //go:build tags to the main source file of each of the principle binaries that will cause compilation to fail early and loudly so the use of old toolchains can be detected quickly. Signed-off-by: Tom Payne <tom@isovalent.com>
/test |
Cilium relies on a number of Go features that are not covered by Go's
backward compatibility guarantee, for example:
There may be other cases where, for example, we rely on bug fixes in the
standard library.
Building Cilium with an earlier version of Go may complete without
error, but there is no guarantee that the binary will behave correctly.
This PR adds //go:build tags to the main source file of each of the
principle binaries that will cause compilation to fail early and loudly
so the use of old toolchains can be detected quickly.
Signed-off-by: Tom Payne tom@isovalent.com