Ubuntu Install Go language development environment

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

There is many ways to configure the Go development environment on your computer, where can choose any one of your like. The three most common ways is as follows.

1, official installation packages
The Go team provides convenient installation packages in Windows, Linux, Mac
and other operating systems. The easiest to get started.

2. Install from source code
Popular with developers, who is familiar with unix-like systems.

3. Use Third-party Tools
There is many third-party tools and package managers for installing Go, like apt-
Get in Ubuntu and homebrew for Mac.

Want to install more than one version of Go on one computer, you should take a look at the tool called GVM. It's the best tool I ' ve seen so far for achieving this job, otherwise you had to know how to deal with this problem by Y Ourself.

The first method of installation
Using GVM

    1. Make sure to install pre-requisite libraries first

sudo apt-get update
sudo apt-get install curl git mercurial make binutils bison gcc

    1. Install GVM

Bash < < (curl-s Https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)

    1. Install Go

GVM Install go1.2
GVM use go1.1.2 [–default]
GVM List

The second method of installation
Install Go Binary

    1. Install Required Libraries

sudo apt-get install python-software-properties # 12.04
sudo add-apt-repository Ppa:duh/golang
sudo apt-get update

    1. Install Go

sudo apt-get install Golang

    1. Export the settings you ' re gonna need to BASH_RC or equivalent:

Export Goroot=/usr/lib/go
Export gobin=/usr/bin/g

Third method of installation
From Source

    1. Dependencies

sudo apt-get update
sudo apt-get install gcc make mercurial git libc6-de

    1. Building from Source

HG Clone-u Release Https://code.google.com/p/go
Cd g o/sRC ./all.bas

    1. The GOPATH environment variable

Go commands all rely on one important environment variable which is called GOP AT H .N oTICeThaTThIsIsNoTThe Goroot where Go is installed. This variable points to the workspace of Go in your computer. (I Use this path in My computer, if you don't have the same directory structure, please replace by yourself.)

Export gopath= H OM E /g oCod eexPoRTP AT H = PATH: $GOPATH/bin

note:-If your Go version is greater than 1.0 and you don't have the to set GOBI N ,aNd ITWILLauTomaTICaLLy beReLaTed Toy ouR Goroot/bin, which we'll talk on the next section

You can install any of the above three. I mostly prefer using GVM. I hope it would help you.!

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.