Go Language integrated development environment is still immature, trial liteide, feel very uncomfortable, pop-up menu to programmer interference too much. So try the big IntelliJ idea, the tool was originally a Java development camp, but it has become a very powerful multi-lingual integration environment.
1. Go environment
Download Go1.5.1 (because of the Great Wall, golang.org visit by the wall, make some technology is not easy, from Golang China's Baidu cloud disk download is a good choice, Http://pan.baidu.com/s/1hq1mrDM), installation is very convenient, Unzip directly into the C:\go directory. Add C:\go\bin to the system PATH environment variable.
2. Idea
Install jdk1.8.0_60_x64, which is installed by default in the C:\Program Files\java directory. Required when installing idea.
Install IntelliJ idea Community Edition 14.1.5 to the default location C:\Program Files (x86) \jetbrains\intellij idea Community Edition 14.1.5.
Start the idea program and, when setting a theme, select Skip All and set Defaults. The tool is ready to be equipped.
3. Compile Go-lang-idea-plugin Plugin
(Do not want to toss this step of the friend here to download I build a good jar file with 1.0.0pre-release build518 compile: http://download.csdn.net/detail/slofslb/ 9182113, no way sometimes to csdn download point material but no points)
Install plug-in go-lang-idea-plugin,jetbrains official plug-in jar file is older, so go to the open source site to find sources to build their own after the installation, the source code of this plugin from this URL download: https://github.com/ go-lang-plugin-org/go-lang-idea-plugin/releases, direct download of source code Master.zip missing idea project file. I downloaded the go-lang-idea-plugin--518.zip, I put it directly under the D:\go-lang-idea-plugin--518.
Open the project with idea, i.e. the d:\go-lang-idea-plugin--518 directory
There will be a Git version control warning, which can be turned off regardless of it.
At this point directly compiled, the SDK does not exist, to make several key settings.
1) SDK Settings
Menu File->project Structure ..., find platform settings/sdk, Dot Plus, add jdk, choose 1.8, note is JDK, not jre,c:\program files\java\ Jdk1.8.0_60.
Plus the IntelliJ Platform Plugin SDK, which is its installation directory: C:\Program Files (x86) \jetbrains\intellij idea Community Edition 14.1.5,internal Java Platform binding 1.8.
Set Project Sdk:intellij idea Community Edition IC-141.2735.5 (Java version 1.8.0)
2) Modules settings
When you enter project Settings/modules settings, you should use the Project SDK for the Module SDK.
3) Compiling
The compiler will have some warnings, but the compilation is successful!!!
4) Generate Jar
Build->prepare all Plugin Modules for Deployment, after success will be in D:\ The Intellij-go.jar is generated in the go-lang-idea-plugin--518 directory, and all we need is this baby. At this point the source code of this go-lang-idea-plugin--518 project is compiled, if you do not engage in Java development, it will not be used in the future.
4, install the plug-in
Enter idea's file->settings->plugin configuration plugin, install plugin from disk ..., select the Intellij-go.jar file, and after OK, you will be prompted to restart IntelliJ idea.
5. Develop the Go project in idea
New project, project type Choose Go
For example, create a Hello project under the D:\goproj\hello folder, prompting you to set up the Go SDK, and find out that idea can automatically find the go1.5.1 directory.
When you create a new hello.go in project, there are two ways to run it, one that corresponds to go build and one that corresponds to go run.
Package Main
Import "FMT"
Func Main () {
Fmt. Println ("Hello World")
}
The official web site gives you a way to create a go project in idea:
Https://github.com/go-lang-plugin-org/go-lang-idea-plugin/wiki/v1.0.0-Setup-initial-project
IntelliJ idea
- Create a new project by going to create new project | Go and follow the setup steps
Other IDEs
- Create a new blank project and you'll be prompted to setup a GO SDK for it
Once you ' ve created the project according to your IDE, please follow the steps below
- After your project have been created, you can then add your gopath packages to it so it's can use all the plugin Featur Es
- To does, go to File | Settings | Languages & Frameworks | Go Libraries. Here's a few options to choose from, but the recommended (and most tested one in the moment) is to create a new ENT Ry under Global Libraries that points to your Gopath directory (see the example bellow). (the emphasis is on adding the project home directory to the global library, so you don't need to set gopath?) )
- If you ' ve followed the steps correctly and then "everything" should
One concrete example would be (under Linux, paths could vary on other OSes):
- Goroot (aka SDK Home)/usr/local/go
- Gopath (the path in Go Libraries | Global Libraries)/home/florin/golang/
- Project Home/home/florin/golang/src/github.com/dlsniper/misc
Some people say that to set these environment variables, but I do not use in 1.5.1, directly with the Go.exe command line tool I used Gopath.
New variable name: GOBIN variable Value: C:\Go\bin
New variable name: GOOS Variable Value: Windows
New variable name: Goroot variable Value: C:\Go
New variable name: Gopath variable Value: D:\goproj\hello
Installing the Go Language plugin in IntelliJ IDEA14