Golang language Installation

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

Ubuntu:

Compiling the installation from source code

Install the GCC tool, because golang some of the features are written in C, so building a Golang compilation is a must

Install gawk GCC  Make

Install the mercurial tool to use the HG command to extract the source code of the Golang

Install Mercurial

Pick and extract, if your network speed is slow, this step will take a little more time

cd/usr/-R release https://go.googlecode.com/hg/go

Compiling Golang

CD go/src. /all.bash

all.bash/all.bat-executes make script and run script
make.bash/make.bat-Install Go
run.bash/run.bat- Test Standard library

So, install go via source, General CD to SRC directory to execute./all.bash. If you do not want to test the standard library, you can directly./make.bash, this will be faster.

Apt-get

sudo Install python-software-propertiessudo add-apt-repository ppa:gophers/go  sudo apt-get updatesudoinstall golang-stable git-core Mercurial

Configuring the System Environment

Vim/etc/profile
Export goroot=/usr/local/Go
#export Goarch=386
#export GOOS=Linux
export GOBIN= $GOROOT/bin/
export PATH= $PATH: $GOBIN

Windows installation:

http://golang.org/dl/

Download unzip

F:\go

Environment variable Description

$GOROOT point to the root directory after the Golang installation, the default is C:/go under Windows platform, which is automatically written to the system environment variables by the installer during installation.
Processor Architecture $GOARCH Target platform (compiled target platform) (386, AMD64, ARM)
Operating system $GOOS target platform (compiled target platform) (Darwin, FreeBSD, Linux, Windows)
$GOBIN point to the Bin directory under the root directory after installation, that is, the default is C:/go/bin under the $goroot/bin,windows platform, which is automatically added to the path variable by the Setup program during the installation process Configuring environment VariablesFinally open cmd, run go version, if you see the following information stating that the configuration environment variable succeeded |–authors-File, official go language author list
|–contributors-File, third party contributors list
|–license-File, Go Language release license Agreement
|–patents-Documents, patents
|– README-Documents, Readme files, you understand. Mention, often someone said: Go official website can not open ah, how to do? In fact, in the readme said this. The file also mentions that if you have a binary installation, you need to set the GOROOT environment variable, and if you put go in/usr/local/go, you can not set the environment variable (under Windows is C:\go). Of course, it is recommended to set goroot whenever you are. Also, make sure that the $goroot/bin is in the path directory.
|–version-File, current go version
|–api-Directory with all API lists for easy access by the IDE
|–doc-Directory, go language of the various documents, the official website, there is basically, this is why the local "official website" can be built. There are many other resources, such as the Gopher icon.
|–favicon.ico-Documents, website logo
|–include-Directory, Go basic tool dependent library header file
|–lib-Catalogs, document templates
|–misc-Table of contents, other tools, the equivalent of a hodgepodge, most of the various editor's Go language support, as well as CGO examples, etc.
|–robots.txt-Files, search engine robots files
|–src-Directory, Go Language Source: Basic tools (compiler, etc.), standard library
|– test-A directory that contains many test programs (not _TEST.GO unit tests, but tests that contain the main package), including some fixbug tests. This can be used to learn some of the characteristics of the use.

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.