GoLand
 
Get GoLand
You are viewing the documentation for an earlier version of GoLand.

Intention actions

Last modified: 23 August 2023

As you work in the editor, GoLand analyzes your code, searches for ways to optimize it, and detects potential and actual problems. Intention actions cover a wide range of situations from errors and warnings to optimization suggestions.

In GoLand, you can use the following types of intention actions:

  • Intention actions yellow bulb icon: an action that generates a piece of code or suggests an alternative variant for your code. Usually, an intention action is applied to a valid piece of code. By clicking the yellow bulb icon, you can view intention actions available in the current context. For example, you can create a constructor that generates values of a struct type. Or, replace the if-else statement with the equivalent one but with a negated condition and swapped if-else branches.

  • Quick-fixes red bulb icon: an action that suggests a solution for a problem in your code. Usually, the intention action is applied to a code that has an error. For example, when you missed brackets at the end of the expression. Or, when you forgot to convert a value to a specific type.