mac配置go环境变量
2016-09-27 22:03
405 查看
1.从官网下载go的pkg安装包进行安装
2.打开终端输入vi ~/.bash_profile
,系统如果没有的话会自动新建该文件(本人的没有…)
3. 写入以下内容
export GOROOT=/usr/local/go export PATH=$PATH:$GOROOT/bin export GOPATH=$HOME/yourpath
4.终端输入
source ~/.bash_profile
5.最后是测试,本人安装版本是go1.6
终端输入:go,输出以下内容
Go is a tool for managing Go source code. Usage: go command [arguments] The commands are: build compile packages and dependencies clean remove object files doc show documentation for package or symbol env print Go environment information fix run go tool fix on packages fmt run gofmt on package sources generate generate Go files by processing source get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet run go tool vet on packages Use "go help [command]" for more information about a command. Additional help topics: c calling between Go and C buildmode description of build modes filetype file types gopath GOPATH environment variable environment environment variables importpath import path syntax packages description of package lists testflag description of testing flags testfunc description of testing functions Use "go help [topic]" for more information about that topic.
终端上输入
go env,输出以下内容:
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GO15VENDOREXPERIMENT="1" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common" CXX="clang++" CGO_ENABLED="1"
6.GOPATH解释:GOPATH变量,Go从1.1版本开始必须设置这个变量,而且不能和Go的安装目录一样,这个目录用来存放Go源码,Go的可运行文件,以及相应的编译之后的包文件。
7.最后推荐一些学习go的书籍和项目
go源码
Go Web 编程
awesome-go
Go入门指南
Asta谢
beego
stathub-go
有问题或建议请联系
邮箱:981017952@qq.com,qq:981017952
相关文章推荐
- linux /mac 下 go环境变量配置
- mac下配置android环境变量
- Mac配置Android开发环境变量及工具安装图(2)
- mac环境变量配置
- mac下adb环境变量的配置以及command not found的解决
- mac下环境变量、maven3.1.1 及 jdk1.7.0.45配置
- mac环境变量配置
- mac cocos2dx android环境变量配置不能修改
- go 语言环境变量配置
- Mac下android_sdk配置环境变量
- mac下配置gradle的环境变量
- Mac配置Android开发环境变量及工具安装图(4)
- Mac 环境变量配置
- cocos2dx 开发配置的一些环境变量(mac/linux)
- Mac配置Android开发环境变量及工具安装图
- mac下配置android环境变量
- Mac配置Android开发环境变量及工具安装图(5)
- mac配置adb环境变量 + 无线调试
- Mac OS X系统下的Android环境变量配置
- mac OS X 10.9.1 配置jdk环境变量