GoLand
 
2025.1
Get GoLand

Formatting strings

Last modified: 04 April 2025

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.

Candidates for printf-like recognition

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.