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 ProgramsFor 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