Go IDE in Windows

In this article, we are going to turn our attention to some Golang IDE’s.
Before we continue with the Go IDE’s, make sure you install Go in your machine. To install Golang in your machine go through this article. Although on the official Golang website there is a list of recommended IDE’s.

IntelliJ Goland is not free and for the beginner, you can try the 30-day trial. After trying it for 30 days, we conclude that Golang is the complete package when it comes to Go development. This entails all the features it provided and easy to install. In addition, JetBrains provides a Go plugin for IntelliJ Ultimate Edition users. For more information about this plugin see Jetbrains Go plugin.

Vim is a free and open-source IDE that supports the programming language Golang. The code editor VIM installation can be a bit confused for beginners since it requires some command through Terminal.

In this article, we are going to focus on the easy to install code editors, so everyone can get them up and running without too many difficult steps in between. From all the available Go IDE’s we are going to focus on the following code editors which can be used as a Go IDE’s which is also easy to install:

Visual Studio Code

Visual studio code is an open-source and free code editor developed by Microsoft which is redefined and optimized for building and debugging modern web and cloud applications. It also supports Git, Github and some additional features such as syntax, highlighting, intelligent code completion, snippets and code refactoring. Furthermore, it is also highly customizable which allow the user to perform the following:

  • Change theme’s
  • Add keyboard shortcut
  • Change preferences
  • Install additional extensions for additional functionalities

Golang plugin

By default, Visual Studio Code does not support Go, but there is Go plugin available in Visual Studio Code. Once the Go-plugin is installed you can start developing Go applications.

VS Code installation

This code editor can be downloaded directly from the official VS Code website.

After downloading VS Code from the official website, just double click the executable file and the installation procedure will starts.

If the launch Visual Code option is checked, VS Code will be launch ones the finish button is clicked.

For a better Go programming experience in VS Code enable the terminal in the code editor. In order to enable terminal in VS Code follow these simple steps:

Installing Go-plugin in VS Code

Installing the Go-plugin in VS Code is a straight forward process by these simple steps:

Create a simple hello world go application in VS Code

Creating a Go file is simply File -> New file and save the file with the .go extension.

Ones the Go file is created, a dialog will appear were VS Code ask you to install the go-outline extension. Select the Install All and the extension will be installed.

Ones the file is created, just type the following Go code and save the file:

package main

import “fmt”

func main(){
  fmt.Println(“Hello World!”)
}

Running your Go code in VS Code

Your Go code can be executed through the VS Code embedded Terminal. Since in this example we save the Go file on Desktop, we need to navigate to Desktop in order to execute the Go file we created.

In order to navigate to Desktop just enter the following command in the VS Code terminal:

cd Desktop

Ones you navigate to Desktop, you can just execute the following command to run your Go codes.

go run hello_world.go


Atom

Atom is an open-source text and code editor with several open-source plugins (known as packages) and it comes with a Git and GitHub already preinstalled by default. Most of the available packages are free of charge since they are developed and maintained by community developers. Atom is fully customizable through HTML, CSS, and JavaScript.

This code editor has several terminal packages, but in this example, we are going to use terminal-tab, for more info about this package see: terminal-tab.

Golang support

Atom by default automatically detects Golang when it is installed on your computer. No additional plugin installation is required.

Installation

Installing Atom on your mac starts by downloading the .zip file from the official website.

After downloading the executable file just double click it and the installation procedure will starts and ones the installation is done it will launch the Atom app.

As you can see on the main screen of the Application, Git and GitHub appear at the bottom right of the screen.

Enable Terminal in Atom

For a better programming experience, it highly recommended installing the Terminal package in Atom. So, you can just run your Go code in Atom without switching to the command prompt each time. In this example, we are going to install the package terminal-tab developed by jsmecham. Select the Install a Package option on the application main screen and the install package window will appear.

Ones the install package window is launch, select Open Installer and insert terminal-tab in the search bar on the left. If everything went well, you must be able to see the terminal-tab appear in the result section. Click install and wait until it is successfully installed. 

To view the terminal in Atom go to Packages -> Terminal -> Open Terminal or press Shift + T and it will appear in the application.

For more information and documentation about the terminal-tab, see terminal-tab documentation.

Writing your first Go app using Atom

Just like the example, we did with VS Code we are going to write a simple Hello World Go application using Atom. We will start off by creating a new file by selecting File -> New File and a blank file is created.

Next, save this blank file as a Go file by File -> Save and save the file with the .go extension. In this example, we will be using the file name atom_hello_world.go. After conducting these steps, your Go file will be created.

Run your Go application using Atom

In order to run your Go application in Atom you must maximize Terminal tab in order to execute the Go application. Sometimes the terminal-tab will be disabled and you need to enable it back through the following shortcut Shift+T and it will re-appear in the application.

For this simple Go app just type the following code:

package main

import "fmt"

func main(){
  fmt.Println("Hello World!")
}

In order to run this sample application, you must open the terminal tab. By default, the terminal tab initiate in the location were the target file is saved (In this example it will start in Desktop).

To run the program just enter the following command:

go run [filename].go

In this case:

go run atom_hello_world.go


Sublime Text 3

Sublime Text 3 is a code editor with a Python application Interface (API). It supports many programming languages and markup languages, and in addition to that, functions and plugins can be added. All these plugins are community-built and maintained under free-software licenses. In Sublime Text 3 comes with a built-in Git feature which allows you to track changes without leaving the code editor.

Golang plugin

Sublime text 3 also has a Golang support package that can be installed using package control. Ones this package is installed you are all set and can start developing your own Go applications using Sublime Text 3.

Installation

Sublime Text 3 is can be downloaded directly from the official website.

After downloading the Sublime Text 3, just launch the executable file and the installation procedure will start.

Sublime Golang support

Before you begin writing your first Go application, there are a few handy packages that need to be installed. These packages are:

  • Golang
  • Terminus (for embedded terminal in Sublime)

Installing packages in Sublime

Packages are installed through the Sublime Package Control. Every installation goes through the Sublime Command palette. The sublime command palette can be launch in Sublime with the following keyboard shortcut:

Installing Golang package in Sublime

The first step before you can start writing your first Go application, you need to install the Go package. These are the steps that need to be taken:

  1. Install the sublime command palette
  2. Install the Golang package

Install the sublime command palette

Before any package can be installed you must first install the sublime package control itself. In order to install the package controller, launch the command prompt as described in the description above and enter the following: package and select the Install Package Control option.

Install the Golang package

The Golang package can be installed through the sublime package control by entering the following steps:

Installing Terminus package in Sublime

In order to get terminal in Sublime Text 3, we are going to install the terminal package terminus. The procedure is identical to the previous steps mentioned above.

To launch terminus, open the sublime command palette and enter terminus and the list of options will appear in the list.

There are two options that you can choose to launch terminus, namely:

  • Terminus: Open Default Shell in Tab (View)
  • Terminus: Open Default Shell in Panel

Terminus: Open Default Shell in Tab (View)

Open the default Shell in Tab (View) will open terminus in a separate tab.

Terminus: Open Default Shell in Panel

Opens the shell at the bottom in the form of a panel which means it will stick at the bottom regardless of which tab you are currently working in.

For this example, we are going to choose the Terminus: Open Default Shell in Panel option. But at all depends on your personal choice. In this example, we are going to use this option and also modified the settings which makes it handy and easy to toggle while using Sublime Text 3.

Launch and modify terminus in Sublime text 3

Select the Terminus: Open Default Shell in Panel option and terminal will be open in a panel at the bottom of the tab.

Terminus modification in Sublime

Ones the terminal is enabled you can start executing commands. To make it a bit easier to toggle between the visibility state of terminus we are going to implement a handy command in the key settings. To achieve this, we are going to implement a handy configuration in the key bindings preference. Perform the following steps to achieve this:

  • Open the sublime package control and enter the Terminus Key Bindings and in the resulting dialog choose Preference: Terminus Key Bindings

Ones the key bindings view open, you will see two sections:

  • Default settings list (Left)
  • Custom Key Bindings settings list (Right)

In the custom key bindings section on the right, enter the following code to enable the toggling of the terminus.

{
	"keys":["ctrl+`"],
	"command":"toggle_terminus_panel",
	"args":{
		"cwd": "${file_path:${folder}}"
	}
}

And lastly, save this custom key bindings settings by pressing Ctrl + s or File -> Save.

Ones this key binding setting is successfully saved, we must be able to toggle the Terminal by pressing the following keyboard shortcut: Ctrl + `.

Writing your Go app in Sublime

Just as the previous example we are going to write a simple ‘Hello World’ Go application. In order to achieve this, we must perform the following tasks:

  1. Create your Go file
  2. Write your app code
  3. Save your Go code
  4. Run your code using terminus

Create your Go file

From the tab that is currently open, you can save the current file that is already open ending it with the .go extension. Saving the current file can be done by pressing Ctrl + s or File -> Save.

Write your app code

After creating the Go file, you are ready to write your Go codes in Sublime. For this Hello World Go application write the following code:

package main

import "fmt"

func main() {
	fmt.Println("Hello World!")
}

Save your Go code

After writing the Go code save the file by pressing Ctrl + s or File -> Save.

Run your code using terminus

Your Go code in Sublime can be run through Terminus. By contrast to VS code, terminus start in the [user] directory. So, you must navigate to Desktop were the Go file is saved, just enter the following command:

cd Desktop

Ones you are in the Desktop just enter the following command:

go run sublime_hello_world.go


Conclusion

The Golang code editors described in this article are easy to install and use. Although for long term use of Sublime Text 3, it recommended purchasing a license of $80,- (One time purchase).

When it comes to pro and cons of the code editors in question, based on a Golang developer point of view, there is not a solid conclusion in this regard. Since most Golang developers use one of these code editors based on personal choice. Other reviews are based on other programming languages and not really related to Golang.

Our recommendation is to download and install these code editors and use them so you can rate them based on your own personal experience.

Relevant resources:

Follow us:

Leave a Reply

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