Skip to content

Instantly share code, notes, and snippets.

@Jyosua
Forked from renevo/go-wsl.md
Last active November 12, 2021 17:51
Show Gist options
  • Save Jyosua/e4cf6c36dab835b8176ba8a9409111a1 to your computer and use it in GitHub Desktop.
Save Jyosua/e4cf6c36dab835b8176ba8a9409111a1 to your computer and use it in GitHub Desktop.
Easily update/install Go in wsl

Updating/Installing Go in WSL Debian

Remove

Removes older versions

sudo rm -rf /usr/local/go* && sudo rm -rf /usr/local/go

Install

Change version as applicable. You can find the latest linux version from the golang install page.

VERSION=1.17.3
OS=linux
ARCH=amd64

cd $HOME
wget https://storage.googleapis.com/golang/go$VERSION.$OS-$ARCH.tar.gz
tar -xvf go$VERSION.$OS-$ARCH.tar.gz
mv go go-$VERSION
sudo mv go-$VERSION /usr/local
sudo ln -s /usr/local/go-$VERSION /usr/local/go

Add Go Environment

You can do this by adding the following line to the bottom of your /etc/profile file (for a system-wide installation):

export PATH=$PATH:/usr/local/go/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment