This is a creation in Article, where the information may have evolved or changed. Go is an open source project with the BSD licensing agreement. The go language is the open source programming language that Google publishes.
Based on the trends in the IT world in recent years, I have learned to follow Google with meat, shame and then brave, to study the Google Genius 20% Project research and development of the new sharp language.
Next, get in touch with go and output the groundbreaking "Hello world!".
Reference website:
http://code.google.com/p/golang-china/wiki/Install# Environment variables
Http://www.cnblogs.com/loulijun/archive/2012/02/10/2345031.html
Practice System: Ubuntu 10.04 LTS.
Installing the C language Tool
The tools chain of Go is written in C and the following development tools are required to build:
GCC
C Language Standard library:
the parser generator Bison
Make
awk
Ed (editor)
$ sudo apt-get install bison ed gawk gcc Libc6-dev make
Installing Mercurial
Mercurial is a version management system.
$ apt-get Install python-setuptools python-dev build-essential$ sudo easy_install mercurial
Get Code
$ HG Clone-r Release Https://go.googlecode.com/hg/go
The system will create a new go directory under the current directory and download the source to go.
Environment Variables
The specific meaning of the variable, see the reference website listed earlier.
$ cd ~$ vim. BASHRC
Add the following information:
Export goroot= $HOME/goexport goarch=386export goos=linuxexport Path=${path}: $GOROOT/bin
Make the environment variable effective.
$ source ~/.BASHRC
Install Go
$ cd go/src$./all.bash
After compiling, print the following information.
All TESTS PASSED---installed Go for linux/386 in/home/me/goinstalled commands In/home/me/go/bin
Writing Programs
$ mkdir test$ cd test$ vim Hello.go
The contents of the Hello.go file are as follows.
Package Mainimport "FMT" Func Main () { fmt. Printf ("Hello world!\n")}
Compiling and running
$ go build hello.go$./hello
Output Hello world!