This is a creation in Article, where the information may have evolved or changed.
1. Install the required compilation environment
sudo apt-get install bison libc6-dev Ed python-setuptools Python-dev build-essential
sudo easy_install mercurial
2. Download the latest Go compilation environment with mercurial
HG Clone-r Release Https://go.googlecode.com/hg/go
Stuck
HG Clone-u Release Https://code.google.com/p/go
Suck
Mainly because of the wall.
You can only manually download source files to Https://code.google.com/p/go (go1.1.2.src.tar.gz)
3. (Go will only be installed by default in the uncompressed directory, which needs to be set in step 5)
CD GO/SRC
./all.bash
4.
When the test case is displayed correctly, it indicates that the go installation was successful
5.
Set Environment variables:
Vim/home/xxxx/.bashrc
Export Goroot=/home/xxxx/cplus/go
Export goarch=386
Export Goos=linux
Export path= $PATH: $GOROOT/bin
(Red must be set)
6.
1 Interpretation execution
Go Run hello.go
2 Compile execution
Go Build Hello.go
./hello