This is a creation in Article, where the information may have evolved or changed.
1, installation
Brew Install Go
2, SET Environment variables:
Gopath is the directory where the program is run
Goroot is the installation directory,
export GOPATH=/Users/songfei/sdk/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN
3,
$~go env
Goarch= "AMD64"
Gobin= "/users/songfei/sdk/go/bin"
Goexe= ""
Gohostarch= "AMD64"
Gohostos= "Darwin"
Goos= "Darwin"
Gopath= "/users/songfei/sdk/go"
Gorace= ""
goroot= "/usr/local/cellar/go/1.5.2/libexec"
Gotooldir= "/usr/local/cellar/go/1.5.2/libexec/pkg/tool/darwin_amd64"
Go15vendorexperiment= ""
Cc= "Clang"
Gogccflags= "-fpic-m64-pthread-fno-caret-diagnostics-qunused-arguments-fmessage-length=0-fno-common"
cxx= "clang++"
cgo_enabled= "1"
Hello.go
package mainimport "fmt"func main() {fmt.Printf("hello, world\n")}
4, compiled into an executable file
Go Build Hello.go
5, download IDE
IDE Download
Click to view "Edit environment variables
# Native Compiler Drawin AMD64Goroot=/usr/local/cellar/go/1.5.2/libexecGOBIN=/users/songfei/sdk/go/binGoarch=amd64GOOS=darwincgo_enabled=1PATH= $PATH: $GOBINgo15vendorexperiment=1PATH= $GOROOT/bin: $PATHLiteide_gdb=/usr/local/bin/gdbLiteide_make=makeLiteide_term=/usr/bin/openLiteide_termargs=-a Terminalliteide_exec=/usr/x11r6/bin/xtermliteide_execopt=-e
If you run an error in the process:
Golangdoc:could not find Godoc, (Hint:is godoc installed?)
Workaround:
Turn over the wall
Go get-v-u golang.org/x/tools/cmd/godoc
Do not turn over the wall
git clone https://github.com/golang/tools $GOPATH/src/golang.org/x/tools