Home  >  Article  >  Backend Development  >  How to set up a go language development environment on mac

How to set up a go language development environment on mac

王林
王林Original
2021-01-07 14:06:223303browse

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.

How to set up a go language development environment on mac

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:

How to set up a go language development environment on mac

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn