Wednesday, February 21, 2024
HomeSoftware EngineeringHow you can Set up Golang on WSL/WSL2

How you can Set up Golang on WSL/WSL2


If you could set up Golang on WSL below Home windows 10 or greater, you may comply with these few steps.

First take away any previous variations mendacity round

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

Decide the newest Go model

Go to https://golang.org/dl/ and discover out what the newest model is. On the time of penning this, Go is on model 1.16.

Set up Go

Be sure that to switch 1.16 under with the up to date model as required.

VERSION=1.16
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/native

Add Go to your setting profile

Open ~/.bashrc and add the next. Keep in mind to replace the 1.16 to the model you put in.

export GOROOT=/usr/native/go-1.16
export GOPATH=$HOME/tasks/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:$HOME/tasks/go/bin

You’ll now be capable to run Go by typing go within the WSL terminal.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments