Translated from: talkonsomething
This article shows you how to install the Google Go compiler on Ubuntu 9.10
The first step: Setup before installation
—————————————————————————————————————————————
A. $GOROOT: The root directory of Go
* At the command line to lose the following command
$ Export GOROOT=/HOME/YOUR-NAME/HG
—————————————————————————————————————————————
B. $GOOS: Operating system name
* Enter at command line
$ Export Goos=linux
—————————————————————————————————————————————
C. $GOARCH: Target Architecture
* AMD64 for AMD bit processor
* 386 (32-bit x86) Intel bit process and
* ARM (32-bit arm, an incomplete port)
Note: Set the target architecture based on your hardware situation
* Command-line Input
$ Export goarch=386
—————————————————————————————————————————————
D. $GOBIN: Specify the directory generated by the binary file
* New Directory/home/your-name/bin
* Assign full permissions.
$ chmod 777/home/your-name/bin
* Set $GOBIN Path
$ Export Gobin=/home/your-name/bin
* Set the $GOBIN path in $path
$ export path= $PATH:/home/your-name/bin
* To verify that the correct, please enter the first line below the command
$ Env|grep ' ^go '
You should return the parameters that are in the form
Gobin=/home/your-name/bin
Goarch=386
goroot=/home/your-name/hg/
Goos=linux
When you are finished setting, you can start the second step setting.
—————————————————————————————————————————————
Step 2: Get the installation package
* If you do not have Mercurial installed on your system, you can install it with the following command
$ sudo apt-get install mercurial
* Then run
$ HG clone-r release https://go.googlecode.com/hg/$GOROOT
—————————————————————————————————————————————
Step three: Before installing, make sure you have the following components GCC, standard C library, parser generator Bison.
$ sudo apt-get install bison gcc Libc6-dev ed
—————————————————————————————————————————————
Step Fourth: Run under the command line
$ cd $GOROOT/SRC
If the file unzip the package in the HG directory, copy it out
And then run:
$./all.bash
If you do not make an error, you will see
---CD. /test
N known bugs; 0 Unexpected bugs