This is a creation in Article, where the information may have evolved or changed.
1. Goroot Gopath and PATH settings
A. Adding system variables Goroot: The first thing to do when you install Go is to set up goroot. For example, my go is installed in the C:\Go directory, you want to set goroot = C:\Go
B. Modify the environment variable path: Add%goroot%\bin to the environment variable path, so that you can run the%goroot%\bin directory program directly in the DOS command mode, such as: Go.exe Godoc.exe
C. Add system variable Gopath:gopath is an important variable to set the package load path. You can set multiple paths, separated by semicolons (;).
For example my gopath = D:\data\golang\letsgo;d:\data\golang;d:\data\golang\beego;d:\data\golang\beeweb;
I import a non-existent xxx bag
The following error is reported (this shows Gopath's important role in package):
Note: The source code of the package to be loaded must be placed in the SRC directory under the Gopath path, or the package will not be loaded
2. Go get download Open source system
Generally open source projects have a variety of dependencies, one Fock too troublesome. Try the go get command.
Below I use go get to get an open source blogging system (Github.com/lisijie/goblog) on GitHub:
1. Set the project path to Gopath (put in front of Gopath, go get to download the code into the first project directory inside the Gopath)
such as: I put the downloaded blog system to the D:\data\golang\goblog directory, then Gopath = D:\data\golang\goblog;d:\data\golang\letsgo;d:\data\golang;d:\data \golang\beego;d:\data\golang\beeweb;
Note: If a git shell is turned on, it is recommended to restart the Git shell, otherwise the Gopath setting is not in effect ...
2. Run go get github.com/lisijie/goblog under git shell for a few minutes ...
3. Go to the D:\data\golang\goblog directory to see