Skip to content

Instantly share code, notes, and snippets.

@t-kuni
Last active December 30, 2022 13:04
Show Gist options
  • Save t-kuni/4e23b59f16557d704974b1ce6b49e6bb to your computer and use it in GitHub Desktop.
Save t-kuni/4e23b59f16557d704974b1ce6b49e6bb to your computer and use it in GitHub Desktop.
How to install and switch between multiple versions of golang

How to install and switch between multiple versions of golang

Install any version

go install golang.org/dl/goX.X.X@latest
goX.X.X download

# Confirm
goX.X.X version

Enter any version in X.X.X.
Version List

Version switching

You can temporarily switch versions with the following command.

export GOROOT=$(goX.X.X env GOROOT)
export PATH="${GOROOT}/bin:${PATH}"

Enter any version in X.X.X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment