Formatting strings
GoLand provides a feature that identifies Printf
-like functions and applies corresponding coding assistance. This includes inspections, quick-fixes, spellchecking, highlighting, code folding, and similar actions.
A function is automatically recognized as Printf
-like if it meets the following criteria:
It is a function or method.
Its name ends with
f
(for example,Printf
,Sprintf
,Foof
).It has at least two parameters.
The second-to-last parameter is a string.
The last parameter is variadic and of the empty interface type (
interface{}
).
In the following screenshot, Printf
-like functions are highlighted in green.

If a function is incorrectly recognized as a formatting function, you can exclude it from the list. You can do this by using intention actions (Alt+Enter) or by configuring the settings.
Exclude formatting functions in the settings
Press Ctrl+Alt+S to open settings and then select
.Click Add (
).
Start typing the name of the function or method that you want to exclude.
Select a function or method from the drop-down list.
Press Enter.
Exclude formatting functions in the editor
In the editor, click the function, press Alt+Enter, and select Exclude string formatting function.
To review or edit excluded functions and methods, open the settings:
open settings by pressing Ctrl+Alt+S and navigate to
.