Under 4.linux configuration environment variable Golang

Linux installed after the priority allocation Golang development environment on linux.

1. Go to Chinese language website to download the Linux installation package

https://studygolang.com/dl

2. Download the catalog next to unzip downloaded files are generally in the "download" or "Downloads" inside

tar zxvf go1. 13 And linux-amd64. tar gz

3. The extract from the "go" file to the directory you want to install, the author placed in your home directory

mv ./Downloads/go ./

4. Create a file folder where the project

mkdir goProject

5. Set Environment Variables

// command line, type "cd" only to your home directory 
$ cd 

// LS -a can view all files in your home directory, the target file is .bashrc
 // be added to the environment variable .bashrc vi 
$ vi .bashrc 

// input the following code 
Export GOROOT = ~ / Go 
Export GOPATH = ~ / goProject 
Export the PATH = $ the PATH: ~ / Go / bin 
Export the PATH = $ the PATH: $ GOPATH / bin 

// press "Esc", then ": wq" to save and exit 

/ / let .bashrc into force 
source .bashrc

6. Detection

$ go version
go version go1.13 linux/amd64

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
...

7. successful, enjoy, installation VSCode be written or Goland Go program, Goland feel very good.

Guess you like

Origin www.cnblogs.com/chenleideblog/p/11520093.html