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.
I figured out 2 ways, to do this:
- For the sake of simplicity. I will keep my host machine unaltered and use a virtual machine to install
gotip, thengopls, and then zed server to use it from the host machine. - Use the latest version of
goplsand have a toggle to switch between
1. Virtual 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@latestUpdate the
.bashrcor whatever shell config that you are using, to setGOBIN,GOPATH.Install the latest version of go using
gotip download.(Optional) Uninstall golang that you have installed using the official repositories.
Note: If you run
gotip downloadto update to the latest development version, it will fail, if no stable go version is found. You might want to keep the go stable version.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.
2. Host Machine #
- You should have go installed on your machine.
- Install
gotip.1go install golang.org/dl/gotip@latest - Install the latest version of go using
gotip download. - Clone the
golang/toolsto build and installgopls. - Build and install
goplsfrom source. - Now when you want to use the development version you can just set the path of
gotipbefore thegostable path.
Final Thoughts #
The first 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.
The second setup will allow you to have a toggle switch between the latest version and the stable version on your host machine.
Happy Goding!