This is a creation in Article, where the information may have evolved or changed.
Do not know what is called Golang please Google, for do not know go program ape, please wall. Although has been doing front-end development, but learning something is always good, just make a record of some simple things, for later need not forget, only for Mac.
Go Download Address
Because it's version 1.6, download it directly.
Go1.6.darwin-amd64.tar.gz
Throw to your own document path decompression can be, this path can actually be based on personal preferences, but configured Gopath and goroot when paired
Set the path in the. bash_profile
export GOPATH=/Applications/Goexport GOROOT=~/Documents/goexport PATH=${PATH}:$GOPATH/bin:$GOROOT/bin
Save. bash_profile file, restart Terminal, of course, with the source command is also OK.
For children's shoes that do not know. bash_profile file, explain two sentences: this is similar to the configuration of the system path in Windows a file, can not find where, please Google!
The command line executes the Go Version command, and if the installation succeeds, the current go release is displayed.
Next is the code editing environment problem, for this everyone has a different answer. Sublime text loaded with a Gosublime plug-in package, after installation remember to set:
{ "env": { "GOPATH": "$HOME/Applitaions/Go" }}
In Liteide, to set the
GOROOT=$HOME/Documents/go
Then start writing go, under/applitaions/go new three folder src,pkg,bin~ code must be under SRC.
package mainimport ( "fmt")func main() { fmt.Println("Hello Golang~!")}