This is a creation in Article, where the information may have evolved or changed.
Finally began to learn go, thoughts quickly, continue difficult, write down will be better
1. Installation
There are many options for installation, such as direct Apititude Golang, under Ubuntu, but in order to be customizable, or go directly to the Golang official website to download the installation package self-installation, the specific process see: golang.org site downloaded and installed A, directly extracted to/usr/ Under Local
2.go Run Configuration path:
Export Goroot=/usr/local/go
Export path= $PATH:/usr/local/go/bin
3. Working Environment Path configuration:
Export gopath=/home/@user/work/goexport gobin= $GOPATH/binexport path= $GOPATH/bin: $PATH
This will ensure that you find your own compiled package or you can compile your own executable file under the system path.
4. Catalog creation:
Mkdir-p $GOPATH/src $GOPATH/pkg $GOPATH/bin
5. Sample Programs
Create a new directory under SRC test, creating Test.go, as follows:
Package Mainimport "FMT" Func Main () { fmt. Println ("Hello World, I ' m Learning Golang")}
Go to the $gopath/bin directory, go run test, you can find the test executable file in the bin directory
Attached: How to compile a custom pkg, can be described in the next article (this is the role of our Pkg directory)
6.vim Configuration
Careful friends will find that, to this step, our code is still very difficult to see, because there is no configuration file, this is our official website downloaded from the file has played a role (this is not directly recommended aptitude purpose)
CD $GOROOT/misc/vim && cp-fr * ~/.vim/&& echo "au bufread,bufnewfile *.go set filetype=go" > ~/.V Im/ftdetect/go.vim
OK, syntax highlighting complete, done