Installation of Go

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

0. Environment: Ubuntu16.04 64-bit

1. Download the installation package, Address: https://golang.org/dl, take version 1.8 as an example, download go1.8.linux-amd64.tar.gz

2. Unzip to/usr/local (official recommendation)

3. Add environment variables at the end of the ~/.BASHRC file:

Export gopath=~/share/go_workspaceexport goroot=/usr/local/goexport GOBIN= $GOROOT/bin/  Export PATH= $PATH: $GOBIN

The value of Goroot is the root directory of Go, and the value of Gopath is the workspace directory

Then execute the source ~/.BASHRC load environment variable into memory

4. Use Go env to view the current GO environment variables

Reference http://blog.csdn.net/weiyuefei/article/details/51160347

5. First program Hello World:

1 Package Main 2 3 " FMT " 4 5 Func Main () {6         FMT. Println ("Hello world! " )7 }

1) Run Hello.go directly with the Go Run command

2) Use the Go Build command to generate a hello executable file

#go build hello.go#. /hello

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.