This is a creation in Article, where the information may have evolved or changed.
See an article saying that IntelliJ idea development as a go development environment is good, suddenly crazy to try a bit.
Who knows follow the tutorial go, to the back more and more wrong, to Baidu other tutorials, who know the same ...
Okay, here we go.
- First put the
GO
installation good ... (Self-installing, attach an article I wrote before Mac install go)
- Installation
IntelliJ IDEA
, download address: https://www.jetbrains.com/idea/download/.
- Download
go-lang-idea-plugin
This plugin, download address: https://plugins.jetbrains.com/plugin/5047. (PS: On-line Baidu's basic is the next source code, compiled, engaged in an afternoon compilation, who knows has been compiled good can download)
After the download, is a zip file, do not need to unzip, open IntelliJ idea, open Preferences->Plugins
, click Install plugin from disk...
, select the zip file just downloaded, and then reboot, plug-in is installed.
Open File->Project Structure...
, can not find a random open a project to see. Click SDKS
, create a new GO SDK
, fill GO
in the installation directory.
To use: Create a new Go project, click Edit Configurations...
, create a new one, and the file to the Go Application
right File
of your files pack main
func main
, and Output directory
output the directory for the compiled file. When you are finished, you can compile and run the program by selecting the new debug option.
Next, let's point to IntelliJ Idea's shortcut key (My Mac OSX):
1. cmd+shift+o Find Jump File
2. Cmd+shift+l Code Alignment
3. Cmd+shift+alt+f Go fmt a file
4. Cmd+shift+alt+p Go FMT Entire project
5. Cmd+alt+o Auto Import
6. Cmd+f12 shows the structure of the current file
7. Press and hold CMD to click on the structure to jump source
8. cmd+p Display function parameters
9. Cmd+e Show recently edited file
Alt+enter Auto Fix Error
Shift+f6 reconstruction