Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 想本地编译tiup,目前我试过从tiup1.12到tiup1.16,都要求go版本在1.19以上,但是我们的编译环境go版本是1.18,我们很多其他组件的编译需要依赖1.18版本的go,所以不能贸然升级go版本。想咨询一下,怎么使用1.18版本的go编译tiup呢?
I want to compile tiup locally. I have tried versions from tiup1.12 to tiup1.16, all of which require go version 1.19 or above. However, our compilation environment uses go version 1.18, and many of our other components depend on go version 1.18 for compilation, so we cannot upgrade the go version rashly. I would like to ask, how can I use go version 1.18 to compile tiup?
You can take a look at this PR, which upgrades the Go version of TiUP from 1.19 to 1.21. The modified files show how to set the Go version. You can revert this part and see if it can compile successfully.
You can install multiple versions of Go locally, and then use the new version to compile TiUP.
When using the go build
command to compile a Go program, if you have multiple versions of the Go runtime in your environment, the compiler may use the runtime that matches the version of the go
command. You can specify which version of Go to use by setting the GOPATH
and GOROOT
environment variables.
Thank you. Currently, we can accept using tiup version 1.10. If we need to upgrade the tiup version in the future, I will try to roll back this PR to see the effect.
Thank you. Currently, we can accept using tiup version 1.10 and compile with go1.18. If we need to upgrade the tiup version in the future, I will also try the suggestion of using multiple versions of go.
Multiple versions of Go are quite a suitable suggestion.