-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
make: check that Go major/minor version matches required version #19528
Conversation
Currently, when building Cilium with a Go major/minor version other than the one specified in `GO_VERSON`, the build currently fails with: package github.com/cilium/cilium/cilium: build constraints exclude all Go files It's not obvious from the compiler error message that this is due to mismatching Go version. This change adds a `check-go-version` target which checks the Go compiler version used for building Cilium (as specified in `$(GO)` against the version pinned in the `GO_VERSION` file, i.e. the version used to build Cilium in CI. This check is required to pass in the `precheck` target which should surface mismatching Go versions in a more user-friendly way. Example with matching version: $ go version go version go1.18.1 linux/amd64 $ make check-go-version Example with mismatching version: $ go1.17.9 version go version go1.17.9 linux/amd64 $ make GO=go1.17.9 check-go-version Installed Go version 1.17 does not match requested Go version 1.18 make: *** [Makefile:602: check-go-version] Error 1 Suggested-by: Aditi Ghag <aditi@cilium.io> Signed-off-by: Tobias Klauser <tobias@cilium.io>
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.
Thank you! 🚀
@tklauser We don't seem to match the minor version though - https://github.com/cilium/cilium/blob/master/daemon/main.go#L6-L6. |
I assume you meant the patch version? If yes, that's intentional. The |
@tklauser Should we backport this to older versions? |
Yes, good point. Let's do that. |
Currently, when building Cilium with a Go major/minor version other than
the one specified in
GO_VERSON
, the build currently fails with:It's not obvious from the compiler error message that this is due to
mismatching Go version.
This change adds a
check-go-version
target which checks the Gocompiler version used for building Cilium (as specified in
$(GO)
against the version pinned in the
GO_VERSION
file, i.e. the versionused to build Cilium in CI. This check is required to pass in the
precheck
target which should surface mismatching Go versions in a moreuser-friendly way.
Example with matching version:
Example with mismatching version: