This is a creation in Article, where the information may have evolved or changed.
language version and IDE
System: Windows
version: go1.7
ide:sublime Text 3 + gosublime + gobuild + gocode
Go Language Environment Building
Go installation
Step description
- Download
- Installation
- Configuring Environment variables
- Inspection
Go Project path settings
IDE Installation and Configuration
There are many Ides that support go language development and can be selected according to your preferences.
The installation configuration process for Sublime Text 3 with gosublime,gobuild , and Gocode is described here.
Step description
- Download
- Installation of package management tools
- Installing the Gosublime Plugin
- Installing the Gobuild Plugin
- Installing the Gocode Plugin
- Set Go nonstandard library tips
- Download
Download Address
-http://www.sublimetext.com/
Tips
-Sublime Text 2 and Sublime text 3 configuration details slightly different
- Sublime Text 3is recommended, but the configuration of Sublime Text 2 is also mentioned below
Installation of package management tools
Installation method
- Reference http://blog.csdn.net/sysu_cm/article/details/52583731
Installing the Gosublime Plugin
Steps
- Open Sublime Text 3
- Use the shortcut key Ctrl + SHIFT + P to open the package management tool
- Enter Pcipin the Open input field, you will see the full control:installpackage displayed in the prompt area, enter Gosublime, and confirm the carriage return installation
Installing the Gobuild Plugin
Steps
- Open Sublime Text 3 (Make sure it is open)
- Use the shortcut key Ctrl + SHIFT + P to open the package management tool
- Enter Pcipin the Open input field and enter Gobuild to confirm the carriage return installation
Installing the Gocode Plugin
The Gocode plugin can add the GO code hint function to sublime Text 3.
Premise
- You need to install a git client and skip the "Install Git method" section if it is already installed
Installing the Git method
- Windowsgit Download Address: http://msysgit.github.io/
- Install after download, default installation path: C:\Program files\git
- When the installation is complete, configure the environment:
- Add C:\Program files\git\bin after the system variable path
- Add C:\Program files\git\mingw64\libexec\git-core after the system variable path
Installing the Gocode plug-in method
- The win key +r key to start the Run window and enter cmd to open the command line tool
- Enter go get-u github.com/nsf/gocode at the prompt
- After get (without any hint, when the prompt appears again, then get done)
- Enter go install Github.com/nsf/gocode at the prompt
-If there is no error message, install it successfully. Otherwise, check to see if your computer's Git client is fully installed
Tips
When the
- git client installs the configuration environment variable, the setting of the value is related to the specific installation location and the version path, which is adjusted according to the actual configuration. For example, some people may have Git-core locations in D:\Program Files\git\libexec\git-core;
- when installing the Gocode plug-in, no information output is normal. When the instruction input is submitted, the prompt will be hidden (execution phase), please be patient, and when the prompt reappears, it indicates that the instruction has been completed.
-
Set the Go nonstandard library hint
to make sublime Text 3 support code hints for nonstandard library packages, you must set the Gopath variable into the configuration file.
setting method
Tips
If you are using sublime Text 2, you need to add the following:
" env ": {" Goroot ": " C:\\go ", " Gopath " : "g:\\goproj" }
Test the development environment
Next we will run a small program to verify that the above configuration process is feasible.
- New code file
- Create a new file "Hello.go"under the SRC folder of the project path and edit the following:
- Run the program
- Using the shortcut key ctrl+b to open the sublime command line, enter go run hello.goat the prompt to see:
- Compiling the build ". exe" program
- Use the shortcut key ctrl+b to open the sublime command line, enter go build hello.goat the prompt, and see the resulting executable file under the Bin folder of the project path.