The following are used in the WINDOWS64 environment, first is the go download, Go has MSI installation and zip decompression installation of two kinds of installation, the use of MSI after the installation of the go environment will be automatically configured, zip decompression need to manually configure various environment variables.
The first is to download, a lot of online search:
After the download is complete, unzip to any directory ( all directories can not be used in Chinese ), for example, my is: D:\Program Files\go
Then the GO environment variable is configured:
Goarch:386 (Go install version)
Gobin:d:\program files\go\bin (exe execution file path)
Goos:windows (go running system)
Goroot:d:\program Files\go (Go decompression path)
Gopath:e:\go\data (Go Toolkit path, arbitrarily specified, will be used later)
Then append to the PATH environment variable:;%gobin%
After completion in the CMD window, enter: Go version
Description of the Environment configuration success! (To this go configuration has been completed)
The following records some of the configuration of Go development in sublime:
The first is the installation of Gocode, the official explanation is that Gocode is a go language automatic prompt plugin, is not very good, new or installed, to prevent a variety of code errors.
Go get-u github.com/nsf/gocodego install github.com/nsf/gocode
After the execution of these two lines, you will find that the Gopath path you just configured (E:\go\data) has a Gocode file that demonstrates the success of the execution.
Then sublime in the Go plug-in installation, there are 2 main plug-ins: Gosublime, Go Build, how to install, please self-Baidu ...
So far, all environments have been configured, and the following tests are done:
Create a new arbitrary file with sublime, modify the suffix named. Go, enter the package and you should be prompted automatically, and then type the following code:
Package Mainimport ( "FMT") Func main () { fmt. Println ("Hello go!" )}
After saving press the shortcut key ctrl+b, pop up the command line shell of Go, choose Run can compile run directly, then have the following output:
> Environment:> gobin=D:\Program files\go\bin> gopath=E:\go\data> goarch=386> goos=Windows> goroot=D:\Program files\go> directory:c:\users\administrator\ Desktop> Command: "D:\Program files\go\bin\go.exe" run-v C:\Users\Administrator\Desktop\demo.go > output:command-line-argumentshello go! > elapsed:0. 755s> Result:success
Where the red font is the program execution result! Over ...
Go Learning Environment Configuration