Get GO work on Mac OS X
Install GO
For Mac OS X, just download pkg file and install it.
$GOPATH
Run GO code should setting $GOPATH first:
$ mkdir $HOME/Document/go
$ export GOPATH=$HOME/Document/go
or you should add GOPATH on .profile file on your home directory, so everytime your Mac OS X start will export the path already.
export GOPATH=$HOME/Document/go
Quick Test
Now, make your new GO project directory
$ mkdir -p $GOPATH/src/hello
and create hello.go file on that directory
$ cd $GOPATH/src/hello
$ nano hello.go
coding your hello.go like:
package main
import "fmt"
func main() {
fmt.Printf("Hello, world. 你好,再见。\n")
}ok, your can install and run that code:
$ go install hello
$ $GOPATH/bin/hello
command line show “Hello, world. 你好,再见。”
Great, it work!