Ubuntu Go language Environment building

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


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.