Is there any open source tool for managing Golang version?

Is there any good way to switch go version in macos?

if using python, we can define python2, python2.7, python3, python3.5 to use different version. but what about go?

we know the go install directory is GOROOT:

$ go env GOROOT

in macOS there usually only one installed. is it possible to install multi go in macOS and switch easily?

Is there any open source tool for managing Golang version?

All of @s0xzwasd’s suggestions, plus:

But the question is, do you really need different Go versions?

For most development needs, the latest Go version is usually the best choice. Due to the Go 1 Compatibility Promise, all your old and older and super old code should work seamlessly with the latest compiler version.

1 Like

I do need different Go versions for contributing to kubernetes.

could you please tell me which one is the most convenient tool for manage the version?

I’d reckon that any dedicated version manager like the ones that @s0xzwasd suggests are more convenient than juggling docker images or manually managing version.

OTOH, official k8s releases are built inside Docker containers anyway, so using Docker images for building seems an option here.

Also worth noting that this doc suggests having the latest available Go version installed for contributing to k8s code.

I am not involved in any way in k8s development, so I can only speculate here, but you might want to find out (from the k8s community perhaps) if the list of Go versions by k8s versions are only minimal requirements. It might well be that all of them still do compile well with the latest Go compiler.

Go is not Python, where new released of the interpreter fail to run old code, and where
breaking API changes are the norm, and where your code needs to be compatible with the
interpreter and library versions installed on the machine.

Rather than looking for tools to switch Go versions, I would just always just use the latest released version (currently 1.17.1).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.