Golang IDE using Intellij IDEA – Step by Step

In this article we will setup a Golang development environment using IntelliJ Community edition IDE

We need to download below software


Put all downloaded installers to a directory on your desktop; lets call it as ‘Golang-Intellij

Follow below steps in the order as explained


Install JDK with default settings
Install PortableGit to C:/Git
Install Golang to C:/Go
Install Intellij IDEA with default settings

Git prompt customization

Goto C:/Git/etc/profile.d/
Edit git-prompt.sh
Comment out the lines ending with # newline ; with this we are making the bash prompt bit more compact
In PortableGit-2.15.0-64-bit version , you can do this by commenting out lines 13 , 15 and 35 (Use notepad++ to get line numbers visible while editing)
Save the file

Customize plugin

Go to C:/Git/bin and start bash.exe
You will get a Bash prompt – execute below commands from bash ; anything starts with ‘#’ indicates comment

cd /c/Users/<your win username>/Desktop/Golang-Intellij
unzip Go-0.171.1931.zip
cd Go/lib
mkdir intellij-build
mv intellij-go-0.171.1931.jar intellij-build/
cd intellij-build
/c/Program\ Files/Java/jdk1.8.0_151/bin/jar.exe xvf intellij-go-0.171.1931.jar
vi plugin.xml # Change the 'until-build="171.*" to 'until-build="172.*" and save the file
# if you are not comfortable with vi , you may edit this file in notepad++ (File location is /c/Users/<your win username>/Desktop/Golang-Intellij/Go/intellij-build/META-INF )
rm intellij-go-0.171.1931.jar
/c/Program\ Files/Java/jdk1.8.0_151/bin/jar.exe cvf ../intellij-go-0.171.1931.jar . # 'dot' at the end of the command is important
cd ..
rm -fr intellij-build
cd ../../

Go to Golang-Intellij directory in desktop and compress Go directory as a zip file (Righ click ->Send to->Compressed zip folder)
Now the plugin (Go.zip) is ready to import to IntelloJ IDEA

IntelliJ IDEA settings

Open IntelliJ IDEA and open a blank project
Go to File->Settings->Plugins->Install Plugin From disk
Here you have to select the zip file we made above (Go.zip) and apply and press OK; don’t restart IDEA at this stage

Import Coding Style

File->Import Settings->Select ‘Ladies Night 2.jar’ File from Golang-Intellij directory on desktop and it will ask for a confirmation ; say OK

Misc settings

File->Settings->Tools->Terminal->Shell Path->C:\Git\bin\bash.exe – press OK
File->Settings->Editor->Code Style->Go-> Set Tab Size , indent and Continuation indent to 4 – press OK
File->Settings->Color Scheme->Color Scheme font and Console Font can be changed to ‘Source code pro’ – press OK
File->Settings->Editor->File Types->Ignore files and folders – add ‘;*.iml;.git;.idea;’ – press OK

Integrate Github account

File->Settings->Version Control->Github->Click Create API Token – You will be asked to enter your Github account credentials – press OK
File->Settings->Version Control->Git->Path to Git executable->C:\Git\bin\git.exe – press OK

Now enjoy your new Golang IDE

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *