Ubuntu Down Go language practice

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

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.