Ubuntu 64 Install Go

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

First of all

Read Https://github.com/astaxie/build-web-application-with-golang/blob/master/1.1.md
Read Http://code.google.com/p/golang-china/wiki/Install at the same time

To download go1.0.3.linux-amd64.tar.gz, execute the following command sequentially:
sudo mkdir/opt/google
sudo tar zxvf go1.0.3.linux-amd64.tar.gz-c/opt/google
VI ~/.BASHRC
Join
Export Gopath= $HOME/go
Export Goroot=/opt/google/go
Export GOARCH=AMD64
Export Goos=linux
Export path= $PATH: $GOPATH/bin: $GOROOT/bin;


Save
SOURCE ~/.BASHRC

Proceed to go, success

Then read on.
Https://github.com/astaxie/build-web-application-with-golang/blob/master/1.2.md
CD ~
mkdir Go
CD Go
mkdir SRC
CD src
mkdir Hello
CD Hello
VI Hello.go, the contents are as follows:

Package Mainimport "FMT" Func Main () {    fmt. Println ("Hello world.\n")}
Save, go to install Now
You will find that the following files are automatically generated
$HOME/go/bin/hello
There is still only one hello.go file under the current folder ($/home/go/src/hello/)
But because $home/go/bin has been added to the path variable
So just run hello and you can play Hello world.

Attention:
Gopath Point to your working folder
goroot The installation directory pointing to Golang

Go build generates executable files in the current directory
Go install generate executable file in Bin directory




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.