1. Install the Go Language development environment

Source: Internet
Author: User
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:


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
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

If you see Hello, World, the development environment is built successfully.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.