Go Language CENTOS7 Installation

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

Reference official website: https://golang.org/doc/install?download=go1.6.2.linux-amd64.tar.gz

Go Install File: https://golang.org/dl/

Linux installation files: https://golang.org/doc/install?download=go1.6.2.linux-amd64.tar.gz

To download the installation file:

Run: Get https://golang.org/doc/install?download=go1.6.2.linux-amd64.tar.gz

Unzip the file:

Run: tar-c/usr/local-xzf go1.6.2.linux-amd64.tar.gz

Set System environment variables:

Operation: Export Goroot=/usr/local/go
Operation: Export path= $PATH: $GOROOT/bin
Operation:export gopath= $HOME/Gopath

environment variable say name:

A. Adding a system variable Goroot:go installation directory

B. Modify the environment variable path: Add%goroot%\bin to the environment variable path, so that you can run the%goroot%\bin directory program directly in the DOS command mode, such as: Go.exe Godoc.exe

C. Add system variable Gopath:gopath is an important variable to set the package load path. You can set multiple paths, separated by semicolons (;).

Note: The source code of the package to be loaded must be placed in the SRC directory under the Gopath path, or the package will not be loaded

Running an instance:

 创建文件夹 

$HOME/gopath/src/hello
$HOME/ Gopath /src Add File hello.go under directory
Package Mainimport "FMT" Func Main () {    fmt. Printf ("Hello, world\n")}

Compile:

Run: Go Install Hello

Perform:

Run: $GOPATH/bin/hello

Show: Hello, World

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.