This is a creation in Article, where the information may have evolved or changed.
For the features of Go, refer to: http://blog.csdn.net/win_lin/article/details/18236737
Go environment
Download Linux 64-bit Go pack: https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
Other references: Http://www.golangtc.com/download
After decompression, move to/urs/local/go:
Tar XF go1.3.3.linux-amd64.tar.gz &&sudo mkdir-p/usr/local/&&sudo mv Go/usr/local/go
Set environment variables Path,goroot and Gopath:
sudo vi/etc/profile &&mkdir-p/home/winlin/go
Settings are as follows:
Export path= $PATH:/usr/local/go/binexport goroot=/usr/local/goexport gopath=/home/winlin/go
Application configuration:
Source/etc/profile
This can be compiled with go build and so on.
Godoc start
Install go to start the Godoc:
godoc-http=:6060
This way the access address can be: http://192.168.1.173:6060
Gotour Environment
Go-tour is a simple example of go and needs to download the project.
Since Google was dropped from the wall, it can be downloaded from a domestic image: Http://golangtc.com/download/package
Mkdir-p $GOPATH/src && cd $GOPATH/src &&wget http://golangtc.com/static/download/packages/ code.google.com.p.go-tour.tar.gz &&wget http://golangtc.com/static/download/packages/ code.google.com.p.go.net.tar.gz &&wget http://golangtc.com/static/download/packages/ code.google.com.p.go.tools.tar.gz &&tar XF code.google.com.p.go.net.tar.gz &&tar XF code.google.com.p.go.tools.tar.gz &&tar XF code.google.com.p.go-tour.tar.gz &&go Install Code.google.com/p/go-tour/gotour
Specific rules reference: http://blog.csdn.net/win_lin/article/details/18236737
Start Gotour:
$GOPATH/bin/gotour-http= "192.168.1.173:3999"
Access Address: http://192.168.1.173:3999/
Go Project
The project directly uses the path of the Gopath.
For example, there are items under $gopath: Src/github.com/winlinvip/srs.go
Then you can directly import the "Github.com/winlinvip/srs.go" inside the various packages.
Compile-time is like compiling for all projects:
Go Build Github.com/winlinvip/srs.go/resarch
Or go to this directory to compile:
CD ~/go/src/github.com/winlinvip/srs.go/research && go build./hello.go &&./hello
The latter is easy to compile at the time of development, in fact it is the right way to compile and deploy your project as all referenced projects.