欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【Mac】mac安装go

程序员文章站 2024-03-16 10:14:37
...

【Mac】mac安装go

1.安装

安装 brew install go 这里采用界面安装 http://c.biancheng.net/view/3994.html
验证 go version

(base) aaa@qq.com ~$ go version
go version go1.14.2 darwin/amd64
(base) aaa@qq.com ~$

2.配置GOPATH

  1. 查看环境变量
(base) aaa@qq.com ~$ go version
go version go1.14.2 darwin/amd64
(base) aaa@qq.com ~$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/lcc/Library/Caches/go-build"
GOENV="/Users/lcc/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/lcc/go" # 你编写代码存放的目录
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"  # 安装目录(go语言安装目录)
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mq/m_t48f8534gb8m0gp5sqvtq00000gn/T/go-build829932643=/tmp/go-build -gno-record-gcc-switches -fno-common"
(base) aaa@qq.com ~$

注意红框的内容:

GOPATH: 你编写代码存放的目录

GOROOT: go安装的路径
相关标签: 系统-mac苹果电脑