This is a created article in which the information may have evolved or changed.
This explains the Golang environment configuration under XP.
- You have configured the sublime text of the Golang development environment, that is, you can run HelloWorld, there are code automatically prompt. If not, refer to
- Here it is assumed that the project name for the PROJCETDEMO,C disk establishes the following folder structure C:\godemo\src\projectdemo. Create a Main.go file below. For example:
- Open with sublime. Then choose Save to Project, I use Projectdemo as project name here. For example:
- To add a folder to the project, here is the Projectdemo folder, as the result (if you installed side bar):
- Open the sublime auto-generated project file and add the project's Gopath so you can execute the GO command directly in sublime, such as:
- Assuming that you now refer to the function in the project Hanlder package, we first execute the Go build,go Run command on the Mainhandler.go, and the system automatically generates. A files, so that other places can invoke such as:
- Call the Hanlders function in main and note how the package is referenced: