This is a creation in Article, where the information may have evolved or changed.
On-line speaking go language build environment build a lot of articles, build environment itself is relatively simple,
This article is mainly to provide a downloadable address, because I have just started to find several addresses have not been able to download to the desired version,
This address was just (2013.04.08 night) tried to access: http://code.google.com/p/go/downloads/list
Downloads page has the following go language development kits, here we choose to download Go1.0.3.windows-386.zip:
Go1.0.3.darwin-386-signed.pkg |
Go1.0.3.darwin-386.pkg |
Go1.0.3.darwin-386.tar.gz |
Go1.0.3.darwin-amd64-signed.pkg |
Go1.0.3.darwin-amd64.pkg |
Go1.0.3.darwin-amd64.tar.gz |
Go1.0.3.freebsd-amd64.tar.gz |
Go1.0.3.linux-386.tar.gz |
Go1.0.3.linux-amd64.tar.gz |
Go1.0.3.src.tar.gz |
Go1.0.3.windows-386.msi |
Go1.0.3.windows-386.zip |
Go1.0.3.windows-amd64.msi |
Go1.0.3.windows-amd64.zip |
|
If the above address can not be down, please go to my micro-disk download: Go1.0.3.windows-386.zip go1.0.3.linux-386.tar.gz
After downloading the Go environment configuration is relatively simple:
1 Unzip the package to go working directory, such as decompression to E:\opensource\go\go, the directory structure after decompression is as follows:
E:\opensource\go\go ├─api ├─bin │ ├─go.exe │ ├─godoc.exe │ └─gofmt.exe ├─doc ├─include ├─lib ├─misc ├─pkg ├─src └─test
2 Add the environment variable goroot, and take the value of the above go working directory
3 The PATH environment variable is added ";%goroot%\bin" in order to be able to directly invoke the GO command to compile the go code, so the Go compilation environment is configured
Note: If you do not want to set the system environment variables manually, you can also download the Go Launch Environment batch attachment.
To modify the Goroot value in the Goenv.bat file to double-click the bat file directly after the Go working directory above, the go compiler environment variable is set to complete.
4 test go to compile the environment, start a CMD window, enter go directly, see the following tip is the build success
E:\opensource\go\go>GoGo isA tool formanaging Go source code. Usage:go command [arguments]the commands are:build compile packages and dependencies clean Remo veObjectfiles Doc run Godoc on package sources env print GO environment information fix run Go tool fix on packages FMT run GOFMT in package sourcesGetdownload and install packages and dependencies install compile and install packages and dependencies List List packages run compile and run Go Program test test packages Tool Run spec Ified Go tool version print go version vet run Go tool vet on Packagesuse"go Help [command]" forMore information about a command. Additional help Topics:gopath Gopath environment variable Packages Description of the package lists remote Remote import path Syntax Testflag Description of testing flags TestFunc description of testing Functionsu Se"go help [topic]" forMore information on that topic.
5 Compile HelloWorld testing program, go Language Pack test directory with Helloworld.go test program, source see "Attached a helloworld.go",
Call "Go build helloworld.go" to generate a "Helloworld.exe" executable program, run this program to see the hello,wolrd we expect.
E:\opensource\go\go\test>Go build helloworld.go E:\opensource\go\go\test>Helloworld.exehello, Worlde:\opensource\go\go\test>
Attach a Helloworld.go
// Cmpout // Copyright: The Go Authors. All rights reserved. // Use of this source code was governed by a bsd-style // license that can is found in the license file. // Test that we can do page 1 of the C book. Package MainFunc Main () { print ("Hello, world\n")}
Modify History:
2013.04.08 First Draft
2013.04.09 added the Go language System Environment Auto-Setup Attachment
2013.04.10 Add the Go Language development package micro-disk download address