Disable leading spaces in comments
After you applied the Reformat Code action (Ctrl+Alt+L), GoLand may add leading spaces before the comment text.
Before the Reformat Code action | After the Reformat Code action |
---|---|
//easyjson:json |
// easyjson:json |
In Go, comments are also used as annotations. In some libraries, spaces between comment markers and annotation instructions are not processed correctly. In the previous example, easyjson:json
is an annotation.
You can disable leading spaces for annotations that start with certain prefixes.
Open the Settings window ( ).
Click
.Click the Other tab.
Select the Add leading space to comments checkbox.
In the Except for space to comments field, click the Add icon ().
Type the prefix name that you want to add as an exception (for example,
easyjson
).Click OK.
Last modified: 12 October 2018