-
Notifications
You must be signed in to change notification settings - Fork 68
Go: Clamp down minimum required version to 1.18 #195
Conversation
Signed-off-by: Aditya Sharma <[email protected]>
8a877ef
to
fcd8424
Compare
Signed-off-by: Aditya Sharma <[email protected]>
Signed-off-by: Aditya Sharma <[email protected]>
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.
I cannot remember the exact scenario, but I have a vague memory recently @epk where some of our tooling, or code gen, or something wasn't compatible with go 1.18 yet. Have you been able to use these changes to build a few different projects that consume this build submodule?
I have tried some upbound repos in: https://github.com/upbound/squad-prodeng/issues/932 and |
@epk Could you test updating |
Opened PRs for both: |
Signed-off-by: Aditya Sharma <[email protected]>
@@ -84,10 +84,14 @@ GOIMPORTS := $(TOOLS_HOST_DIR)/goimports | |||
GO := go | |||
GOHOST := GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go | |||
GO_VERSION := $(shell $(GO) version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') | |||
GO_REQUIRED_VERSION := 1.18 | |||
ifneq ($(GO_VERSION),$(GO_REQUIRED_VERSION)) |
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.
We used to have something like this but the friction it creates turned out to be more than the benefits we're getting for streamlining. So, I'd opt to let individual projects impose this requirement if they'd like to in their Makefile
s.
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.
Made GO_REQUIRED_VERSION
customizable in 09af1ab
Signed-off-by: Aditya Sharma <[email protected]>
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.
Thanks @epk !
@epk I have different projects using different Go versions and I went ahead and added this override for each of them, but now I have to have a different Go binary for each version. It's possible to set up but I'm questioning the value we get here with this requirement given that Go is perfectly fine building projects with different versions and it errors out when the compatibility is broken. Do you feel strongly about this? Is there a value I'm not seeing other than having the locally built binaries same as production? I'd like to revert it if not. |
I have been using https://github.com/travis-ci/gimme to automatically load the go versions as required. I'll comment back tomorrow but several upstream K8s dependencies also now strictly require 1.18 because of the usage of I'd rather try to get everything to 1.18 and then change the version check to support two versions like rook's build libraries: https://github.com/rook/rook/blob/8df00d7dd10cf784842c04cbabceabe9cacfcf7c/build/makelib/golang.mk#L105 |
FWIW, when Go 1.17 sees |
This check is causing trouble and confusion since it is being invoked even if you don't call a target building go code. |
Signed-off-by: Aditya Sharma [email protected]
Description of your changes
-i
flag for go invocationsWhy?
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR, as appropriate.How has this code been tested