gvs
allows you to quickly install and use different versions of Go via the command line. The installation is easy. Once installed, simply select the version you desire from the dropdown.
Example:
$ gvs
Use the arrow keys to navigate: ↓ ↑ → ←
? Select go version:
▸ 1.21.3
1.21.2
1.21.1
1.21.0
1.20.10
✔ 1.21.3
Downloading...
Compare Checksums...
Unzipping...
Installing version...
1.21.3 version is installed!
$ go version
go version go1.21.3 darwin/arm64
gvs is a version manager for go, designed to be installed per-user, and invoked per-shell. gvs works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix and macOS.
Warning
Windows will be supported in a later version.
gvs
is available for MacOS and Linux based operating systems.
Important
Make sure to delete any Go versions installed already before installing gvs
.
gvs is available via brew.
$ brew install VassilisPallas/tap/gvs
Installation for other linux operation systems.
$ curl -L https://raw.githubusercontent.com/VassilisPallas/gvs/HEAD/install.sh | bash
Alternatively, you can install the binary from source.
Before start using gvs, read the below:
Important
gvs installs the go
and gofmt
binaries in $HOME/bin/
. Make sure to append to your profile file: export PATH=$PATH:$HOME/bin
, otherwise the terminal will not be able to find them.
$ gvs
Use the arrow keys to navigate: ↓ ↑ → ←
? Select go version:
1.21.3
▸ 1.21.2
1.21.1
1.21.0
1.20.10
✔ 1.21.2
Downloading...
Compare Checksums...
Unzipping...
Installing version...
1.21.2 version is installed!
$ go version
go version go1.21.2 darwin/arm64
- Select the version you want to be installed by using the up and down arrows.
- Hit Enter to select the desired version.
To see a list with all versions, stable and unstable (release candidates) ones, just use the --show-all
flag.
$ gvs --show-all
Use the arrow keys to navigate: ↓ ↑ → ←
? Select go version:
▸ 1.21.3 (stable)
1.21.2 (stable)
1.21.1 (stable)
1.21.0 (stable)
1.21rc4 (unstable)
1.21rc3 (unstable)
1.21rc2 (unstable)
To install the latest stable version, use the --install-latest
.
$ gvs --install-latest
Downloading...
Compare Checksums...
Unzipping...
Installing version...
1.21.3 version is installed!
To install a specific version without using the dropdown, use the --install-version=value
flag.
$ gvs --install-version=1.21.3
Downloading...
Compare Checksums...
Unzipping...
Installing version...
1.21.3 version is installed!
If the Minor
version is not specified (--install-version=1
), the latest Minor
version is selected from the given Major
version.
If the Patch
version is not specified (--install-version=1.21
), the latest Patch
version is selected from the given version.
You can also pass Release Candidates, like 1.21rc2
.
You can also install a version that is specified in a go.mod file. You can use the flag --from-mod
. This will look for any go.mod
file under the same path gvs
was executed on the terminal.
$ gvs --from-mod
Downloading...
Compare Checksums...
Unzipping...
Installing version...
1.21.3 version is installed!
Every time you install a new version, gvs keeps the previous installed versions, so you can easily change between them. If you want to delete all the unused versions and keep only the current one, use the --delete-unused
flag.
In the below example, the versions 1.20
and 1.19
are previously installed, and since they are not used (neither of them is the current version you use), they will be deleted after installing the new version 1.21.2.
$ gvs --delete-unused
Use the arrow keys to navigate: ↓ ↑ → ←
? Select go version:
1.21.3
▸ 1.21.2
1.21.1
1.21.0
1.20.10
✔ 1.21.2
Downloading...
Compare Checksums...
Unzipping...
Installing version...
1.21.2 version is installed!
Deleting go1.20.
go1.20 is deleted.
Deleting go1.19.
go1.19 is deleted.
All the unused version are deleted!
gvs caches the versions that are fetched from https://go.dev/dl
in order to avoid overloading the server with requests.
The cache expires after a week, but if for any reason you'd like to force the fetch, you can use the --refresh-versions
flag.
$ gvs --refresh-versions
Use the arrow keys to navigate: ↓ ↑ → ←
? Select go version:
▸ 1.21.3 (stable)
1.21.2 (stable)
1.21.1 (stable)
1.21.0 (stable)
1.21rc4 (unstable)
1.21rc3 (unstable)
1.21rc2 (unstable)
Note
You can combine the flags --refresh-versions
and --show-all
to refresh the list and see all the versions.
For more help you can use the --help
flag.
Contributions are very much welcomed! In order to contribute, the required version is 1.21.0
.
For more information regarding contributions, feel free to read the contributing.md file.
After cloning the repository on you local machine, you can run the below commands:
# install the dependencies
make install-deps
# run the tests
make test
# build the project
make build
There a many Makefile recipes, feel free to run make
. The default make
command will print a short documentation for each recipe.
Note
Recipes like format
, lint
, vet
and test
also run in Github Actions, but it should be nice to run them yourself as well before committing the changes. If you think this needs to be a git hook, I'll be more than happy to include it.
See LICENSE.md