Formatting strings
GoLand provides a feature that identifies Printf
-like functions and applies corresponding coding assistance to them (for example, inspections, quick-fixes, spellchecking, highlighting, code folding, and so on).
A function is automatically recognized as Printf
-like. The criteria for a function to be a candidate for Printf
-like recognition are:
It is a function or method.
Its name ends with
f
(for example,Printf
,Sprintf
,Foof
).It contains at least two arguments.
The second-to-last argument is a string.
The last argument is variadic and of the empty interface type (
interface{}
).
On the following screenshot, Printf
-like functions are highlighted in green color.

You can exclude the function from the list of Printf
-like functions if it was detected as formatting automatically. To exclude the function, use intention actions by pressing AltEnter or go to 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 a method from the drop-down list.
Press Enter.
In the editor, click the function and press AltEnter, and select Exclude string formatting function.
To edit functions and methods that were excluded from the list of formatting functions, open settings by pressing CtrlAlt0S and navigate to Go | Formatting strings. .
Thanks for your feedback!