This is a creation in Article, where the information may have evolved or changed.
Go Language Development installation package under Windows
Official Download Address:
Https://code.google.com/p/go/downloads/list
Go Language Civil Service network (with reference and documentation)
http://zh.golanger.com/
Method/Step
- 1
Download the Go Language Development Kit under windows in the Go Language Google Code project (download address see tools). There are two versions of Zip and MSI installed as per this download. (It is convenient to use the MSI installation version here.)
- 2
Download to get an MSI installation file and run it. All the way next to set the installation path here. If you need to change the installation path.
Note: Never have Chinese in the path. Otherwise, you will not be able to use the Go Language development tool properly.
- 3
Wait for installation to end ....
Installation Successful
- 4
Because the MSI installation file is used, the Go Language environment variable is set up automatically.
Note: If the following HelloWorld program does not work, or if you are using a ZIP package, you can set the environment variable here:
System Variable Name:
Goroot
Value:
Where Go is installed
System Variable Name:
Path
Append value:
;%goroot%\bin
- 5
When the installation is complete, verify that the go is installed correctly:
Open a command prompt in Windows (Cmd.exe) to execute the command:
Go version
If the go version is displayed as normal in the diagram, the go has been installed in your computer properly.
- 6
Let's test the HelloWorld of the Go language:
Code:
Package Main
Import "FMT"
Func Main () {
Fmt. Printf ("helloworld!")
}
Code Note:
Func Main () {
Can not be written
Func Main ()
{
This is not just code specification, but also the syntax of Go. Or you'll get an error.
- 7
Save, compile, execute:
1. Save to a xxx.go file (I saved here to C:\test.go)
2. Compile and execute the command at the command prompt:
Go build-o C:\test.exe C:\test.go
Or
Go Build C:\test.go
(Note: The exe file with the output specified above has C:\test.exe, and the following will generate Test.exe (which may not be C:\test.go location) under the current path.)
3. Execute, execute the command at the command prompt:
Test.exe
You can see the helloworld! words on the screen.
- 8
In this step, the development environment of Go language is set up and the discussion is over.
END
Precautions
Step Two:
Note: Never show Chinese in the installation path. Otherwise, you will not be able to use the Go Language development tool properly.
Fourth Step:
Note: If the following HelloWorld program does not work, or if you are using a ZIP package, you can set the environment variable here:
System Variable Name:
Goroot
Value:
Where Go is installed
System Variable Name:
Path
Append value:
;%goroot%\bin
sixth step:
code Note:
Func main () {
cannot be written as
func main ()
{
this is not just the code specification, but the syntax of go. Otherwise the error will be