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 (AltEnter) or by configuring the settings.
Press CtrlAlt0S to open settings and then select Go | Formatting functions.
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.
In the editor, click the function, press AltEnter, and select Exclude string formatting function.
To review or edit excluded functions and methods, open the settings:
open settings by pressing CtrlAlt0S and navigate to Go | Formatting strings.
Thanks for your feedback!