1. Go Language SDK installation package to download and install
The latest stable version 1.5.3 installation package go1.5.3.windows-amd64.msi Download https://golang.org/dl/, about the size of 69 MB (author uploaded a version of the installation package to CSDN resources, too foreign Suman can go to download: http: //download.csdn.net/detail/defonds/9408855), run directly after download and install, the installation path you use it the default C: \ go \ can, after all the way and finish Next installation.
2. Go language environment variable settings
Go language you need to configure two GOROOT and Path environment variables: GOROOT and GOPATH.
2.1 directory GOROOT and Path
If the first step is installed using the default installation directory C: \ Go \, then the installation program has two GOROOT and Path environment variable is set up, no longer need to be manually set.
The first step if you do not use the default installation directory, you need to configure on these two variables, be careful not to affect other installation programs (such as Java, Oracle, Maven, etc.) when Path configuration.
2.2 Go GOPATH working directory
This is a follow-code directory, the new system variable GOPATH, to point to your code directory:
2.3 command-line environment variables to verify
Open CMD terminal, enter go env variable is set to see success:
Note that the red line marking section is correct.
3. Write the first Go program
Creating hello.go file and edit its contents as follows:
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
After saving access to the directory, do go run hello.go:
See "hello, world" We go to prove the installation was successful.