Install go language under Ubuntu

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

Install go language under Ubuntu

The go language is an open source project developed by Google, one of the purposes of which is to improve developer productivity. Go language grammar is flexible, concise, clear and efficient. Its concurrency features can be conveniently used for multi-core processors and network development, while flexible and innovative type systems can easily write modular systems. Go can be compiled quickly, with the garbage Memory auto-recycle feature, and also support runtime reflection. Go 11 is an efficient, static type, but the post office has a system-level syntax that interprets the dynamic type characteristics of the language.

Because only introduced Ubuntu under 386 of the Go Language installation method, other platforms can be viewed on the http://code.google.com/p/golang-china/

1. Install the Go Language tool

?
sudo apt-get install bison ed gawk gcc libc6-dev make

If the above is not installed on the May cause the later can not be installed, users may also be installed, so that the insurance write

2, installation Mercurial

Mercurial is actually a version management system (can be detected by HG name is installed), similar to Git

?
sudo apt-get install python-setuptoolssudo apt-get install python-devsudo apt-get install build-essential

3. Get the Go Language source

4. Configure Environment variables

$vim. BASHRC open the. bashrc file in the home directory, add the following information, referring to the official documentation

Export goroot= $HOME/go
Export goarch=386
Export Goos=linux
Export Path=${path}: $HOME/bin

Save Save after exit execution

$source. BASHRC

Make it effective

5. Install go language, compile go environment

$CD GO/SRC

$./all.bash

Start compiling, the following information is displayed when compiling is completed

You can also view the version information by following the command

6, then we can start to work, the Go language suffix is. g,8g is the compiler, 8l is the connector. Can be written with vim, or other tools can be

Here is one of the problems, when writing if the left curly brace "{" A single line will compile an error

The following problems occurred after compiling

Modify it to the following way.

Compile run

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.