Using Latest Unreleased (Development) Version
Note: This holds for future “versions” of Go, and not just version 1.27.0.
gotipwill get the latest commit from the git repo and builds Go, this means that you will have the latest “version” of Go based on the most recent commit.
I wanted to use Go version 1.27.0, before the official release. I also, wanted to keep using 1.26.X on my host machine.
I can install the gotip tool, and use it download the latest development version of Go. Then, I can use gotip like the go command to build, run and install.I also wanted to have an LSP in my editor, either helix or zed.
For the sake of simplicity1. I will keep my host machine unaltered and use a virtual machine to install gotip, then gopls, and then zed server to use it from the host machine.
Steps #
- Spin up any linux distribution you like.
- You need to install SSH, and UFW (If you want to enable firewall).
- Install the golang version provided by the official repositories.
- Install
gotip.1go install golang.org/dl/gotip@latest - Update the
.bashrcor whatever shell config that you are using, to setGOBIN,GOPATH. - Install the latest version of go using
gotip download. - Uninstall golang that you have installed using the official repositories.
- Clone the
golang/toolsto build and installgopls. - Build and install
goplsfrom source.
You can now install Zed server, or use ssh + tmux to write code using helix for example.
Zed Server #
Follow the official guide to install Zed server on the virtual machine.
Why Not Build gopls and Use It?
#
We can build gopls with gotip on the host machine, and that will help us have support for Go development version and previous versions of Go. But that works in theory, because gopls will try to download the toolchain when GOTOOLCHAIN is set to auto, and since the development version of Go is yet unreleased, gopls will fail and will not be able to download the toolchain.
Final Thoughts #
This setup will sandbox the latest unrealesed version of Go in a virtual machine, and have the stable version of Go on your host machine. You can still write stable go code on your host machine, and unstable on the virtual machine.
Using Zed client on your host machine to access the Zed server on the virtual machine will make your coding experience as smooth as coding on the host machine.
Mixing Go development version that is not yet released with Go versions that are released, might cause some problems. ↩︎