GO language installation and environment variable settings in Linux

title

Download go language source code

 wget https://golang.google.cn/dl/go1.16.6.linux-amd64.tar.gz

Decompression: tar -zxvf go1.16.6.linux-amd64.tar.gz

Enter the bin directory

cd /usr/local/go/bin

./go version

output

go version go1.16.6 linux/amd64

Set GOROOT and GOPATH

vim /etc/profile

write at the end

export GOPATH=/home/workspace
export GOROOT=/usr/local/go
PATH=$GOROOT/bin:$PATH

 Where workspace is your working directory

source /etc/profile

Make the environment variable take effect immediately

Guess you like

Origin blog.csdn.net/z09364517158/article/details/131403946