How to build a go language development environment on mac: 1. Execute the [brew install go] command to install go; 2. Execute the [go env] command to obtain GOPATH; 3. Execute the [export GOPATH=/xxx] command to modify Just GOPATH.
The operating environment of this article: MacOS X system, GO 1.11.2, macbook pro computer.
(Learning video sharing: Programming video)
Specific steps:
The easiest way to install go under mac is through homebrew
Direct execution:
brew update && brew upgrade brew install go
You need to specify GOPATH after the installation is complete (go does not need to be specified after version 1.8, there will be a default value)
After the go installation is completed, you can Execute go env on the command line to obtain the current GOPATH
The execution results are shown in the figure below:
GOPATH can be modified through the following commands
export GOPATH=/xxx/xxx/xxx
At this point, the go development environment is set up.
Related recommendations: golang tutorial
The above is the detailed content of How to set up a go language development environment on mac. For more information, please follow other related articles on the PHP Chinese website!