Github: VersionFox
This article mainly introduces a new way to manage multiple versions of Golang, a brand new tool called VersionFox
.
One of the most common problems in daily life is that the company's project uses version 1.18.1, but I want to use the latest version 1.21.6 for my personal project. What should I do?
Before I developed this tool, it was like this:
For those with obsessive-compulsive disorder, it's quite uncomfortable to look at, right? Also, every time I need to add a new version or switch versions, I have to modify the .zshrc file, repeatedly commenting and adding environment variables.
Also, as you can see, I'm dealing with other languages and tools! This process is even more painful!
So, I decided to develop a more universal version management tool VersionFox (I know there are some ready-made tools available, but haha, keep reading and you'll see).
What is VersionFox?
Simply put, it's a cross-platform, universal, extensible SDK version manager~
- Cross-platform (Windows, Linux, macOS), providing the same user experience across different platforms
- Manage all languages with consistent commands
- A simple plugin system to add support for the SDKs you need
- Supports Global, Project, Session scopes (important!!)
- When you switch projects, it automatically switches to the corresponding version
Quick Start
1.Install vfox
VersionFox supports multiple platforms (Windows, Linux, macOS). For demonstration, we use Homebrew
for quick installation. (For detailed installation, please see Installation)
$ brew tap version-fox/tap
$ brew install vfox
Hook VersionFox
to your Shell (choose one from the following items that suits your shell)
echo 'eval "$(vfox activate bash)"' >> ~/.bashrc
echo 'eval "$(vfox activate zsh)"' >> ~/.zshrc
echo 'vfox activate fish | source' >> ~/.config/fish/config.fish
# For Powershell users, add the following line to your $PROFILE file:
Invoke-Expression "$(vfox activate pwsh)"
2. Add Golang plugin
After installing VersionFox, you can't do anything yet, because VersionFox uses plugins as extensions, and you need to install the corresponding plugins first.
Of course, if you don't know which plugins to add, you can use the
vfox available
command to check all available plugins
$ vfox add golang/golang
3. Install the latest version
Command: vfox install golang@<version>
After the plugin is successfully installed, you can install the corresponding version of Golang
. For example, we use the following command to install the latest version:
$ vfox install golang@latest
4. Switch versions
Command: vfox use golang
After successful installation, you can freely switch the version of Golang
. Use the following command to select the version you want to switch to:
$ vfox use golang
$ go version
go version go1.21.6 darwin/amd64
Scopes
Sometimes, we need to handle multiple projects at the same time. If all projects use the same version, there is no problem. But the reality is often not so ideal!
Session Scope
Only valid within the current shell session, shells are isolated from each other and do not affect each other
Command: vfox use -s golang
Project Scope
A .tool-versions file will be created in the current directory to record the version used in the current project. The scope is limited to the current directory, and the version will automatically switch when the directory is switched
Command: vfox use -p golang
Global Scope
The scope is global, no need to explain, it's everywhere! ๐
Command: vfox use -p golang
Other Commands
Search Command
The current golang/golang
plugin gets version information by parsing https://go.dev/
, keeping in sync with the official version, so there is no delay~
Question: So how do we know what the current available versions are (or I just want to see what the top 3 latest versions are)?
Answer: Through the vfox search golang
command, you can view all available versions, support search, and support pagination
Also, for easier use, after selecting the target version on the current search page, press Enter to install immediately, no need to execute the vfox install
command again!
View Installed Versions
Command: vfox ls golang
Uninstall Specific Version
Command: vfox uninstall golang@<version>
For more commands, please see All Commands
Conclusion
By now, I think you've realized the power of VersionFox
. ๐
Also, as a universal SDK version manager, VersionFox is not limited to Golang, it currently supports multiple languages or tools, for details please see Plugin Repository
Come and experience it~ Welcome to use and feedback bugs, if you have good ideas you can also raise issue~
If you find it helpful, please give us a star๐๐, to show your support, thank you ๐~~
Github: VersionFox
Top comments (0)