Features

How Do You Become More Productive with GoLand? Complete Interactive Courses!

GoLand has a lot of features, and it can be overwhelming at first. The trick is to remember the most important IDE actions and shortcuts, and the rest will follow.  

To help you, we have created the Learn GoLand section on the Welcome screen. It contains several interactive courses, meaning you can try out the features with the code yourself following the instructions.

The Learn GoLand section is updated regularly. Recently we added the Onboarding Tour, a brief overview of the main features, which we think are especially useful to know about if you are coming from another IDE or editor. 

Now let’s show you around. 

How to use Interactive Courses

You will find the Learn GoLand section on the left of the Welcome screen. Click the Start Learning button, and you’ll begin from the first course. Clicking elsewhere inside the Learn IDE Features area will expand the list of available courses. You can choose any of the interactive courses you like the sound of from the list. 

When you open a course, you will see some instructions in the Learn tool window. Follow the instructions and look at how the code on the right is changing. 

If a shortcut doesn’t work, you can click on the shortcut in the Learn window. A pop-up window will appear with two options, Apply this action, and Add shortcut. The first one is self-explanatory, and the second one will open another window where you can add your own combination of keys to the list of available shortcuts. 

In some lessons you will see highlighted controls that will help you to find the relevant actions. 

You can reset a lesson by clicking on the refresh arrow at the top of the Learn window. 

To reset all the lessons back to their original state, go to Preferences/Settings | Tools | Feature Trainer and press the Reset Lessons Progress button. 

In the same settings window you will see the Learning main programming language list, where you can select Go or JavaScript. 

Now we will show some of our favorite tips and tricks, which you can try out for yourself in the IDE. 

Handle errors

You can use postfix templates to change the expressions you have already typed and to generate code. Postfixes are very useful, like when you need to handle an error.

Let’s see how the varCheckError postfix works. Type . (dot) and vce after the function/method call, and press Tab or Enter – the IDE will create the missing variables that are returned, and will handle the error.  

The rr postfix does almost the same, except that it creates only an error variable (a blank identifier is used to discard the other return), and handles it on the same line as the method/function call. 

If you want to quickly create the if err != nil {} boilerplate, type err.nn. 

You can do the same by typing if and selecting the appropriate boilerplate from the list.

Fill struct fields

When you create an instance of a struct, you can generate field names automatically. Place the caret between curly braces, press ⌥ ↩ (Alt + Enter for Windows) to see the available Intention Actions, and select Fill all fields.   

Time package completion

GoLand can give you a hint when you use time.Parse(). Place the caret inside double quotes where the layout string should be, and press ⌃ Space (Ctrl + Space). You will see a list of suggestions – choose the appropriate one, then type a separator and continue with the month, and so on.  

Rename

To use Rename refactoring, press ⇧F6 (Shift + F6). GoLand will rename all the instances of the variable you want to change. 

That’s not all! You’ll find many more tips and tricks in our Feature Trainer – open the IDE and try it out! Would you like us to add something? Let us know! Write a comment here, tweet us, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel.

image description

Discover more