go1.4.darwin-amd64-osx10.8.pkg | go1.4 Mac OS X (x86 64-bit) PKG installer |
创建目录下的go文件夹: mkdir ~/go 下面的东西放到.bash_rc(也可能是.bash_profile或者.zshrc) export GOROOT=/usr/local/go export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin
source ~/.bash_profile
go env go version
运行结果: liuxinmingdeMacBook-Pro:gotest liuxinming$ go env GOARCH="amd64" GOBIN="" GOCHAR="6" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/liuxinming/go" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common" CXX="clang++" CGO_ENABLED="1" ===========华丽分割线=============== liuxinmingdeMacBook-Pro:gotest liuxinming$ go version go version go1.4 darwin/amd64 liuxinmingdeMacBook-Pro:gotest liuxinming$
package main import "fmt" func main() { fmt.Printf("hello, world\n") }
{ "cmd" : [ "/usr/local/go/bin/go" , "run" , "$file" ], "file_regex" : "^(...*?):([0-9]*):?([0-9]*)" , "working_dir" : "${file_path}" , "selector" : "source.go" }
原文地址:http://blog.csdn.net/liuxinmingcode/article/details/42491181