Golang Install on CentOS

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

Installing mercurial

You need to install the mercurial version management system before doing the following operations (you can output HG noun detection for installation). Enter the following command to install:

Yum Install mercurial

Get code

The following command creates a go directory. Switch to the appropriate directory and make sure the Go directory does not exist at the current location, run the command:

- r release HTTPS : //go.googlecode.com/hg/go

Install Go

To compile the GO environment:

when the compilation is complete, the following information is printed at the end. installed Go  forLinux/AMD64inch /Home/ You/Go. installedcommandsinch /Home/ You/Go/bin. ***  Youneed to add/Home/ You/Go/bin to your $PATH. * * * Set $path$ cd/etc/profile.d/$ vi go.shexport goroot=/Home/ You/Go export gobin= $GOROOT/bin
Export GOARCH=AMD64
Export Goos=linux
Writing Programs

For example, use the Hello.go code to compile the command:

Package Mainimport "FMT" Func Main () {FMT. Printf ("Hello world\n")}

$ go Build hello.go
$  ./hello
about how to manage compiling a go project see
  https://golang.org/doc/ code.html   

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.