This is a creation in Article, where the information may have evolved or changed.
Environment configuration Golang Configuration under Windows # #一 the Go language installation package download * Download the Go language installation file http://code.google.com/p/go/downloads/list install to the d:\Go\ directory * New environment variable goroot=d:\go\ add environment variable path=%path%;D in PATH: \go\bin* set the workspace settings gopath environment variable to define the Go package that the system needs to find when compiling. Gopath below should contain the directory src: Contains the go source file pkg: Contains the compiled package object bin: Executable command When importing a package, the GO command is first looked up from the goroot/src/pkg directory, and if not, it is looked up from the GOPATH/SRC directory. # # Everything starts from HelloWorld to build a HelloWorld project, create a new helloworld.go file in the SRC directory, with the following package Mainimport FMT "FMT" Func Main () {FMT. Printf ("Hello, world; orκαλημέρακόσμε; Orこんにちは world \ \ ")}## go compile * Go build command Go Build command, it is like install, just build all objects in a temporary directory, and do not install them into the pkg or bin. When you build a command, the executable file named after the last element of the import path is written to the current directory. When a package is built, go build serves only to test whether the package and its dependencies can be built. * Go install we usually use go install to build. Go install builds the file and compiles the relevant target file. A to pkg, build the executable file to the bin. When using a local package at the Gocode prompt, you need to go to build to obtain the. a file. Run go install, which will build and install the binaries in the $gopath directory to the $GOPATH/bin: OK, because it is Golang all the utf-8,win7 will be garbled. This is a small thing, not to care about it. (Input chcp 65001 can display utf-8,chcp 936 display GBK) * Golang IDE tool download 1) download Golang and install liteidehttps://github.com/visualfc/golangide/ Downloads configuring Liteide's Go Runtime gopath and engineering GOPATH2) Use sublime text to open after installation: Ctrl + ' Open command line, execute the following code: Import urllib2,os;pf= ' package control.sublime-package '; ipp= Sublime.installed_packages_path (); Os.makedirs (IPP) if not os.path.exists (IPP) Else None;open (Os.path.join (IPP,PF), ' WB '). Write (Urllib2.urlopen (' http://sublime.wbond.net/' +pf.replace (', '%20 ')). read ()); print ' Restart Sublime Text to finish installation ' Open Package Controll Enter package Control:install package and enter Gos Ublime, Go build,sidebarenhancements and install this time to restart the sublime, you can find in the menu bar more than one of the following the Package control column, indicating that the packages have been installed successfully. 3) Install the code hint to install Google Git:cmd run go get-u github.com/nsf/gocode. Gocode.exe files will be produced in D:\Go\bin. Try the liteide input, there should be a code hint.