-
Notifications
You must be signed in to change notification settings - Fork 4.1k
MINOR: specify Go toolchain version #3170
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
base: master
Are you sure you want to change the base?
Conversation
@@ -1,3 +1,4 @@ | |||
module github.com/apache/thrift | |||
|
|||
go 1.23 |
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 do not have much experience with go but during my hackings (unrelated) found that if I set this version to 1.23.0 I get a valid makefile (See this commit: 5d2d4ad)
If your change is the correct one then thanks :)
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 think specifying minimum release version 1.23.0 in go
line or toolchain
line works. Having toolchain line seems a bit more specific.
@@ -1,3 +1,4 @@ | |||
module github.com/apache/thrift | |||
|
|||
go 1.23 | |||
toolchain go1.23.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.
See my comment above, is this something that should not be done in all the files my commit touched?
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.
Good catch, thanks! I will add them.
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.
go
command will only try to download a toolchain according to go.mod
when your local, existing go
version is below it. Any go version below 1.23 is no longer supported, so you should upgrade your local go installation instead. Alternatively it could be caused by you have wrong GOTOOLCHAIN
environment set.
we do not want to specify the patch version on the go
line in go.mod
file because that line indicates the minimal version of go required, and we do not depend on any specific patch version on 1.23.x, we support all versions of 1.23.x. We also don't want to add toolchain
line into go.mod
file because, again, we support any go toolchain from 1.23, we want our users to use the latest release or whatever version they see fit as long as it's 1.23+, we don't want to specify any specific version.
tl;dr: this is an issue with your local go toolchain, not with the code.
Thanks for reviewing, @fishy! To your point though, having For this auto-switching to work though, we'll need specify not just the language version One sticky point is whether we want this auto-switching... Here is what I see:
I think (2) seems better. Plan B - if we don't want to go as far as auto-switching as in (1), one idea is to improve the makefile generation to catch somewhat cryptic the toolchain-not-found error, and suggest a hard upgrade, rather than chucking up a garbled makefile: Line 380 in 67f8280
Feel free to let me know which way we prefer. References: |
the problem with auto-switching is that you need to specify the version to be used when user is below that version. so if an user's local go toolchain is 1.22.x, auto switch will switch to 1.23.0. and the problem is that we don't want them to use 1.23.0, there are several bugs, a lot of them security related, fixed in later 1.23.x versions. we want them to use the latest version of 1.23.x, or even the latest version of 1.24.x. and no one is going to update that line every time a new patch version is released. and also, as I have said before, any version before 1.23.0 is already no longer supported and not receiving any security updates. so people should not be using those versions, and any supported version will work with thrift's go code (see our go version support policy at https://github.com/apache/thrift/blob/master/lib/go/README.md#suppored-go-releases) |
When building from source,
go.mod
is missing the toolchain version, resulting in incorrect Makefile generation:The error can be seen from
go
as well:$ go verison go: downloading go1.23 (darwin/arm64) go: download go1.23 for darwin/arm64: toolchain not available
This is due to the separation of the language version and the release version of Go [1,2].
To fix the build, this patch adds the toolchain version
1.23.0
.Testing
References
[skip ci]
anywhere in the commit message to free up build resources.