This is a creation in Article, where the information may have evolved or changed.
The go language officially supports two types of compiler Toolchain GC and GCCGO, but the GC is more mature. So this article will learn how to install more sophisticated GC tools.
There are two ways to install a GC: 1, installed from the binary release version. 2, install from the source code. The following will learn how to install from binary. For information on how to install the source code, refer to the following links:
Http://go.tuna.tsinghua.edu.cn/doc/install/source
Currently the GC Toolchain supports only the operating system and architecture.
Operating System |
Architectures |
Notes |
|
FreeBSD 7 or later |
AMD64, 386 |
Debian GNU/KFREEBSD not supported |
Linux 2.6.23 or later with glibc |
AMD64, 386, arm |
Centos/rhel 5.x not supported; No binary distribution for ARM yet |
Mac OS X 10.6/10.7 |
AMD64, 386 |
Use the gcc†that comes with Xcode |
Windows $ or later |
AMD64, 386 |
Use MinGW gcc†; Cygwin or msys is not needed |
Once you have identified your operating system and architecture, you can go to the following link http://code.google.com/p/go/downloads/list to find the appropriate installation package to download. Because my operating system is Ubuntu, so here download the go1.1.1.linux-386.tar.gz.
After everything is ready, here is the installation process. The installation process is simple and can be consulted as follows.
tangle@tangle-virtualbox:~$ ls
Desktop Documents Downloads examples.desktop go1.1.1.linux-386.tar.gz Music Pictures public Templates Vi DEOs
tangle@tangle-virtualbox:~$ pwd
/home/tangle
tangle@tangle-virtualbox:~$ tar-c./-xzf go1.1.1.linux-386.tar.gz
tangle@tangle-virtualbox:~$ ls
Desktop Documents Downloads examples.desktop go go1.1.1.linux-386.tar.gz Music Pictures public T Emplates Videos
Then export the environment variables in ~/.profile:
Export goroot= $HOME/go
Export path= $PATH: $GOROOT/bin
This way you can test your development environment. The test can be done by creating a Test.go file in any directory, as follows
Package Mainimport "FMT" Func Main () { fmt. Printf ("Hello, world\n")}
After editing the Test.go, run it with the following command.
tangle@tangle-virtualbox:~/go/ltang2$ Go Run test.go
Hello, World
tangle@tangle-virtualbox:~/go/ltang2$
If you see Hello, World, the development environment is built successfully.