This is a creation in Article, where the information may have evolved or changed.
1. The C language Tool go tool chain is written in C, the following development tools need to be installed: GCC, C language standard library, Bison, make, awk, etc. For Ubuntu/debian systems, run the Install command: sudo apt-get install bison ed gawk gcc Libc6-dev make
2, Installation Mercurial
The Mercurial version management system (which can output HG name detection is installed) needs to be installed before any subsequent operations. Install enter the following command:
sudo easy_install mercurial
For Ubuntu/debian Systems, the Easy_install command can be used
Apt-get Install Python-setuptools Python-dev build-essential
installation.
If the above command fails to install, you can also download it from Mercurial Download.
3. Get the Code
The following command creates a go directory. Switch to the appropriate directory and make sure the Go directory does not exist at the current location, run the command:
HG Clone-r Release Https://go.googlecode.com/hg/go
It is generally not routed to Google
So you can click to open the link to download go1.3.3.src.tar.gz
4, add go1.3.3.src.tar.gz to Ubuntu under the decompression
root@ubuntu:~# tar-zxf go1.3.3.src.tar.gz root@ubuntu:~# ls1.txt go go1.3.3.src.tar.gz yankring_ History_v2.txt
You will see a go file in the current directory
5. Install Go
CD Go/src./all.bash
Post-compilation End information:
ALL TESTS PASSED
---
installed Go
for
linux
/amd64
in
/home/calvin/go
installed Commands
in
/home/calvin/go/bin
*** need to add
/home/calvin/go/bin
to your PATH.
6. Configure Environment variables
MKDIR/USR/LOCAL/GOCP -rp bin Doc include/lib//usr/local/go/vi/etc/profile
Plus:
Export path= $PATH:/usr/local/go/binexport goroot= $HOME/lnk
This allows you to compile the go file directly under Home/lnk.
7. Testing
root@ubuntu:/home/lnk/restgo# VI hello.goroot@ubuntu:/home/lnk/restgo# root@ubuntu:/home/lnk/restgo# root@ubuntu:/ home/lnk/restgo# go run hello.go Hello, world
----------------------------------------------------
Test go, classic Hello World
Hello.go File Contents:
root@ubuntu:/home/lnk/restgo# Cat Hello.go
Package Mainimport "FMT" Func Main () {FMT. Printf ("Hello, world\n")}