| .gitignore | ||
| go.mod | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
GoGetter
Description
This is a handy tool for manually installing the latest version of Go in a directory of your choice. This gets around the limitations of the package managers being kept up to date. By default, this binary will reach out to the go.dev website, and compare that version to the version specified by "go version" on your local machine. If the website is newer, it will download the new go tarball and extract it to a directory of your choice. IMO, this is much easier than waiting on package maintainers, or trying to build from source on distros like Debian which don't get the latest packages.
It was designed to be run via cron so that you can always have the latest version without extra effort. You can do this via a crontab or create a small bash script that calls this binary and put the script in /etc/cron.daily
Becuase we are attempting to manually manage our Go version, if you don't have any version of Go already unpacked, you can use the -force flag to make it download the most recent version regardless of the local machine state. This will give it something to compare to in later automated runs.
Note
This program assumes you are running on an x64 Linux machine. If you want to download different builds, just edit line 104 in main.go where it defines inner.Os="linux" and inner.Arch="amd64" to the appropriate values. You can see those builds here
Examples:
- This will install the go folder to $HOME/.local. The tarball is downloaded to /dev/shm by default. The path to the go binary will be $HOME/.local/go/bin so be sure to modify your path
GoGetter -force
- This is a setting you might use as root in the crontab to install go in /usr/local for all system users. The path to the go binary will be in /usr/local/go/bin so be sure to modify your path.
GoGetter -output /tmp/go.tar.gz -path /usr/local