Indentation
Indentation settings are configured for every programming language separately.
GoLand displays the indentation information in the status bar. So, if your project has files of different types, the easiest way of learning the current indentation style and accessing the corresponding settings is to use the Indentation widget.
Since indentation is configured separately for each programming language, the number of indentations displayed may vary between opened items. To view the indentation in the status bar, open a file containing the relevant code in the editor.
Configure indentation style
In GoLand, you can configure indents in code style schemes or in .editorconfig files.
Open indentation settings in code style scheme
Click the widget and select Configure Indents for Go.
In the dialog that opens, you can change settings for tabs and indents and also configure other code style settings. Click OK.
Reformat the necessary part of your project to apply new indentation settings.
Open indentation settings in .editorconfig
Files in which code style settings are specified via .editorconfig files have the icon in the widget.
Click the widget and select Open .editorconfig.
The IDE opens the nearest .editorconfig file which affects the file that you're currently working with. To view a list of all available .editorconfig files, click Show Files Related to Project.
Make your changes and reformat the necessary part of your project to apply new indentation settings.
Detect indents automatically
You can configure GoLand to detect the indentation style in the current file and use this style instead of the indents specified in the code style settings for a specific language.
Press Ctrl+Alt+S to open settings and then select
.Select the Detect and use existing file indents for editing checkbox.
Apply the changes and close the dialog.
To disable automatic indentation, go back to settings and deselect the checkbox or click the Indentation widget and select Disable Indents Detection for Project.