Ubuntu under Golang Environment installation steps

Source: Internet
Author: User
Tags mercurial
This is a creation in Article, where the information may have evolved or changed.

1, environment variable settings

~$ CD

~$ mkdir Go

~$ mkdir Bin

~$ sudo gedit. BASHRC

At the end of the bash file, add the following code to set the directory variable:

Export goroot= $HOME/go
Export Goos=linux
Export goarch=386
Export gobin= $HOME/bin
Save File
~$ source. BASHRC
~$ sudo gedit/etc/profile
At the end of the file modification Path,path does not exist, add the following statement directly, otherwise add

Export path= $HOME/bin: $PATH
Save File
~$ Source/etc/profile
Perform env | grep ' ^go ' tests whether the GO environment variable has been set correctly

2. Get Resources

~$ Hg clone-r release https://go.googlecode.com/hg/$GOROOT

If it is not successful, install mercurial first:

~$ sudo apt-get install mercurial

3, installation

~$ sudo apt-get install bison gcc Libc6-dev ed

~$ CD $GOROOT/src

~$ ./all.bash

Wait a few minutes and finally it will Self-test---CD. /test

~$ CD

~$ mkdir Hellogo
~$ CD Hellogo
~$ Cat >hello.go <<eof
>Package Main
>Import "FMT"
>Func Main () {
>Fmt. Printf ("Hello, world/n"
> }
> Eof
~$ 8g Hello.go
~$ 8l hello.8
~$ ./8.out
Hello, world

4, reference

1,golang official website http://golang.org/


Original address: http://blog.csdn.net/xinshg/article/details/5199651


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.