This is a creation in Article, where the information may have evolved or changed.
Http://www.golangtc.com/download
Download 1.4.2 and 1.6.2
TAR-ZXVF go1.6.2.linux-amd64.tar.gz-c/usr/local/src/
Ln-s/usr/local/src/go1.6.2/usr/local/go
Set environment variables for Go
Vi/etc/profile
Source/etc/profile
Write a simple Go example
Sayhello.go and the. Go source code files in the SayHello directory produce a code package (. A) file that is similar to the C language static library, each source code can have an init function
Hello.go Import SayHello Code package call code package SAYHELLO.GO source code in the Hello method output string
Import format
"Package name (can alias)" "Hello SayHello"
Hello/sayhello/sayhello.go
Hello/hello.go
Scripting Mode execution
Go Run hello.go
Compiled into Elf executable execution
CD ~/goproject/hello
Go Install
CD ~/gobin
./hello