Are you tired of writing Go code in a simple and boring text editor? Don't worry. In this topic, we are going to explore GoLand — an Integrated Development Environment (IDE) built specifically for Go software engineers with features like code completion, project navigation, refactorings, and of course code debugging.
GoLand
The GoLand Logo
GoLand is a cross-platform IDE by JetBrains. It allows you to work on Go projects, but also supports front-end development in JavaScript, HTML & CSS, and database connections & query tools, plus many other features.
License programs
GoLand offers a free 30-day trial version; however, if you're a student or a teacher, don't miss the opportunity to get free access to all the JetBrains IDEs and tools. Read more and apply here.
Free Educational Licenses
An important detail is that if you are an active JetBrains Academy student, you will eventually get a free 30-day All Products Pack license for JetBrains products, just look into your notifications:
All products pack free license notification in JetBrains Academy
Take notice that apart from being an active JetBrains Academy student, to get the free license you also need to have a connected JetBrains account in your JetBrains Academy profile. You can read more about personal educational licenses here.
Install and run GoLand
Before you start, check the requirements for memory and operating systems in the GoLand System Requirements.
Download and install GoLand
Download GoLand from the JetBrains official website;
Run the installer and follow the wizard steps. See more details in the GoLand Installation Guide.
Launch GoLand
To launch GoLand, perform the following action depending on your operating system:
Windows: Run GoLand using the Windows Start menu or the desktop shortcut;
macOS: Run the GoLand app from the Applications directory;
Linux: Run the
goland.shshell script in the installation directory under bin.
Welcome to GoLand
The first time you launch GoLand, you will see the Welcome screen:
On the Welcome screen, you can find all options and settings to start your work in GoLand. The fastest way to get started is to create a new project from scratch.
To create a new Go project, just click on the New Project button and replace awesomeProject with the title you want your future masterpiece to have.
Create a New Project menu
If you don't have Go installed in your system, simply click the + button and then Download in the GOROOT section. A drop-down list will pop up for you to select what version of Go to download for your project:
After you're done naming your project, click the Create button and wait for GoLand to create the project. When this process is complete, you will see a Project tool window:
As you see, it contains several items:
awesomeProject: the files of your future project will be stored in this directory;
External Libraries: this represents all the "external" resources you use in the project;
Scratches and Consoles: you may need to create temporary notes or a draft code outside your project. For this purpose, you can create the files in this category instead of switching to another code editor.
Code writing
We're ready to start writing our first Go program using GoLand! Let's create a new main.go file within the awesomeProject directory.
To do this, right-click the awesomeProject directory and select New -> Go File from the context menu.
Creating a new.go file
Take notice that after creating a new main.go file, GoLand will make the package name the same as the project name, by default. In our case, it is package awesomeProject.
Changing the package name
To properly execute our program directly within GoLand, we'll just need to change the package name to package main and then click the green arrow at the left of the func main statement:
Finally, we will see the program output in the Run window at the bottom of the GoLand editor:
An important detail is that we can also execute our Go program by clicking the green arrow near the top-right corner of the window beside the Debug button, or by clicking the other green arrow on the left side of the Run window at the bottom of the GoLand editor.
Congratulations! You've just created your first Hello, World! program in GoLand! For more information on how to run programs in GoLand, check the running applications section.
Plugins and personalization
We can customize GoLand with different plugins. If light-colored themes drive you crazy, and you want to change the default version to something cool or less hurtful for your eyes, the Plugins section is the one you're looking for.
The Plugins section in GoLand
To access the plugins section, just go to File -> Settings and then click on Plugins in Windows and Linux.
Accessing Plugins in Windows and Linux
In macOS, you'll need to click on GoLand -> Preferences -> Plugins.
Accessing Plugins in macOS
Within the Plugins window, click the Marketplace window (look at the first purple-themed picture), and you can choose to install any fancy theme or extension you like!
If you want themes, we recommend the Atom OneDark Theme along with Atom Material Icons for custom file icons. Another cool theme (showcased in the first two pictures of this section) is the Dark Purple Theme (...Purple Gang!)
Apart from themes, the Plugins section also contains extensions like Python Community Edition that allow you to work on other programming languages, such as Python, in GoLand, and of course the JetBrains Academy plugin — it will allow you to solve coding tasks in GoLand (and in other JetBrains IDEs, as well).
For more in-depth knowledge about GoLand, you can take a look at the official GoLand documentation. Also, if you're a complete beginner at Go, you can take a look at the GoLand Quick start guide that could answer many of your questions.
Conclusion
Let's summarize what we've covered in this topic:
GoLand is a cross-platform IDE; this means that you could use it on Windows, Linux, and macOS almost identically;
The Welcome screen provides a quick way to create, open, or clone a Go project;
You can personalize GoLand to make it look the way you'd like;
JetBrains provides free license programs for educational purposes.