Go environment settings

Source: Internet
Author: User
Tags install go
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.&&-p /usr/local/&&sudo mv go /usr/local/go

Set environment variables Path,goroot and Gopath:

mkdir -p /home/winlin/go &&sudo vi /etc/profile

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-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, the following items are $gopath: src/github.com/winlinvip/srs.go
Then you can directly import "github.com/winlinvip/srs.go" inside the various packages.
Compile-time is like compiling for all projects:

go get github.com/winlinvip/srs.go/srs && $GOPATH/bin/srs

In fact, it is the right way to compile your project as if it were all referenced projects.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.