How to Manage Go Versions with ASDF
James Reed
Infrastructure Engineer · Leapcell

Key Takeaways
- ASDF simplifies managing multiple Go versions across projects.
- It supports global and local Go version settings.
- Easy installation, updating, and removal of Go versions.
Managing multiple versions of Go (Golang) can be challenging, especially when working on different projects that require different versions. ASDF, a powerful version manager, allows developers to easily install and switch between multiple Go versions. This guide will walk you through the process of setting up and using ASDF for Go.
What is ASDF?
ASDF is a flexible runtime version manager that allows you to manage multiple versions of various programming languages with a single command-line interface. It supports many languages, including Go, Node.js, Python, and Ruby, through community-maintained plugins.
Using ASDF for Go has several advantages:
- Easily install and switch between different Go versions.
- Project-specific Go versions using
.tool-versions
files. - Consistent version management across different development environments.
Prerequisites
Before you begin, ensure you have the following installed on your system:
- Git (for installing ASDF and plugins)
- Curl or Wget (for downloading ASDF)
- ASDF (if not installed, follow the steps below)
Installing ASDF
If you haven't installed ASDF yet, you can do so with the following commands:
macOS (using Homebrew)
brew install asdf
Linux
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1 echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc source ~/.bashrc
For Zsh users, replace .bashrc
with .zshrc
.
Verify that ASDF is installed correctly:
asdf --version
Installing the Go Plugin for ASDF
To manage Go versions, you need to install the Go plugin for ASDF:
asdf plugin add golang https://github.com/kennyp/asdf-golang.git
Check if the plugin is installed:
asdf plugin list
This should display golang
in the list.
Installing and Managing Go Versions
List Available Go Versions
To see all available versions of Go:
asdf list all golang
Install a Specific Go Version
To install a specific version of Go, use:
asdf install golang 1.22.0
Replace 1.22.0
with the version you need.
Set the Global Go Version
To set a default (global) Go version:
asdf global golang 1.22.0
Set a Local Go Version (Per Project)
To specify a Go version for a particular project:
cd /path/to/your/project asdf local golang 1.21.1
This will create a .tool-versions
file inside the project directory.
Verify Installed Version
To check the current Go version:
go version
Updating Go Versions
To update Go, first list installed versions:
asdf list golang
To install the latest available version:
asdf install golang latest
Then, update the global version:
asdf global golang latest
Uninstalling a Go Version
To remove a specific Go version:
asdf uninstall golang 1.21.1
Additional ASDF Commands
- Check Installed Plugins
asdf plugin list
- Update ASDF and Plugins
asdf update asdf plugin update --all
- Remove a Plugin
asdf plugin remove golang
Conclusion
ASDF provides a simple and effective way to manage multiple Go versions on your system. By using ASDF, you can ensure compatibility across projects and avoid conflicts between different Go versions. Whether you're working on personal projects or enterprise applications, ASDF makes version management hassle-free.
If you're frequently switching between Go versions, integrating ASDF into your workflow will save you time and effort. Try it out today and streamline your development environment!
FAQs
Use asdf local golang <version>
in your project directory.
Run go version
to verify the active Go version.
Install the latest version with asdf install golang latest
and set it using asdf global golang latest
.
We are Leapcell, your top choice for hosting Go projects.
Leapcell is the Next-Gen Serverless Platform for Web Hosting, Async Tasks, and Redis:
Multi-Language Support
- Develop with Node.js, Python, Go, or Rust.
Deploy unlimited projects for free
- pay only for usage — no requests, no charges.
Unbeatable Cost Efficiency
- Pay-as-you-go with no idle charges.
- Example: $25 supports 6.94M requests at a 60ms average response time.
Streamlined Developer Experience
- Intuitive UI for effortless setup.
- Fully automated CI/CD pipelines and GitOps integration.
- Real-time metrics and logging for actionable insights.
Effortless Scalability and High Performance
- Auto-scaling to handle high concurrency with ease.
- Zero operational overhead — just focus on building.
Explore more in the Documentation!
Follow us on X: @LeapcellHQ