码迷,mamicode.com
首页 > 系统相关 > 详细

mac安装go环境

时间:2020-06-05 20:57:54      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:top   otool   led   tmp   pthread   cbo   learn   lang   sudo   

https://golang.google.cn/dl/
 

sudo vim /etc/profile

11 export GOROOT=/usr/local/go

 12 export GOPATH=${GOROOT}/gopath

 13 export PATH=$PATH:${GOROOT}/bin

 14 export GO111MODULE=on

 15 export GOPROXY=https://goproxy.cn

 

source /etc/profile 

说明:
1. GOROOT 为go安装目录, 在mac下使用pkg包安装的, 目录为 /usr/loca/go

 

如果用go mod gopath 设置为/usr/local/go/gopath 

 

查看环境 

go env 

macdeMacBook-Pro:www mac$ go env 
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mac/Library/Caches/go-build"
GOENV="/Users/mac/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mac/Desktop/go_learn"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/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/fc/4txmmczj6q92p6058h3w7t_80000gn/T/go-build984019761=/tmp/go-build -gno-record-gcc-switches -fno-common"

 

cd /Users/mac/Desktop/go_learn

macdeMacBook-Pro:go_learn mac$ go mod init brady

go: creating new go.mod: module brady

macdeMacBook-Pro:go_learn mac$ export GO111MODULE=on

 

mac安装go环境

标签:top   otool   led   tmp   pthread   cbo   learn   lang   sudo   

原文地址:https://www.cnblogs.com/php-linux/p/13051675.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!