Archlinux installs the go language development environment

1. Install go

sudo pacman -Syyu
sudo pacman -Sy go

View the go installation directory

2. Set up the environment

The value of this environment variable should be the current installation directory of the Go language

export GOROOT=/usr/lib/go/bin

The value of this environment variable should be the set of workspaces in the Go language

export GOPATH=~/golib:~/goproject

It is the directory where the executable file of the Go program is stored

export GOBIN=~/gobin


To facilitate the use of Go language commands and executable files of Go programs, PATH needs to be appended to its value.

export PATH=$PATH:$GOROOT/bin:$GOBIN

Append the setting code of these environment variables to the .bash_profile file (or a profile) in the home directory and
make it effective immediately after editing the profile file:
source 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325339394&siteId=291194637