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.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.

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.