Recently began to study the go language, 工欲善其事, its prerequisite, to achieve the first Hello world, we have to configure the development environment first!
I was using Eclipse development under Windows, I encountered some problems when installing the configuration development environment, and logged it so that friends who encountered the same problem could refer to
I. Download and install the development kit
1. First step, install the Go Language Development Kit, download address: https://studygolang.com/dl
Select the appropriate installation package, my system is 64-bit Win7, so I chose Windows-amd64.msi, after downloading the installation program, I am the default installation to C:\Go.
2. The second step, after the installation is completed by default in the system environment variable path after adding the Go installation directory of the bin directory C:\Go\bin, and add the environment variable goroot, the value is the installation root of Go C:\Go;
In this case, add the Go workspace variable Gopath to the environment variable, the value I set to D:\appcsm\go (because I use Eclipse as the development tool, and the go language plug-in to develop, so in the previous Eclipse workspace added to the work space of the Go language), Append%gopath%\bin after the environment variable path.
3. The third step, restart the system, open the command line, enter go env, there is a content display that the Go Development package installation is complete, and then see the content of the Gopath is the path just set, then the setting is successful.
II. Install the Go language plugin under eclipse
1. I use eclipse as a development tool, and the installation process is skipped here. Launch Eclipse, select Menu Help->eclipse Marketplace, enter go in the Find field of the Search tab and click the Go button to search for the Goclipse plugin, as
Install the installation.
Note: When I came to this step, eclipse error:
Then install plug-ins on Eclipse Marketplace This path does not go through, crossing do not worry, the solution is to choose the menu in Eclipse Help->install New software, add warehouse Goclipse,
The site is: https://raw.githubusercontent.com/GoClipse/goclipse.github.io/0.16.0/releases/, such as:
Choose Goclipse Plug-in to install, install a bit slow, slowly wait for success, restart can.
2. After installing the plugin, restart Eclipse, select menu Window->preference->go configuration Installation
3. Then continue to configure, choose Menu Window->preference->go->tools, here need to download 3 tools:
When I download the second guru.exe here, the total failure, if you also encounter this situation, do not worry, we also download the solution
We'll download it from Https://github.com/golang/tools.
After downloading the zip archive, create the directory golang.org\x\tools in the SRC directory of the Go workspace and extract all the files from the tools directory in the zip to the directory; Enter the command in the command line go install Golang.org\x\tools \cmd\guru,
After execution, it is found that Guru.exe has been generated in the Go Workspace bin directory. So far, the development environment for the go language under Windows has been built.
Third, open Hellow world
Click menu File->new->other
Create a project and start programming.