Skip to content

inefficient-sprintf

Detect fmt.Sprintf calls used only for simple conversions.

Updated View as Markdown

Default severity: warning

Simple %s, %t, and base-10 integer conversions can use the string directly or the corresponding strconv function without format parsing and reflection.

Bad

text := fmt.Sprintf("%d", number)

Good

text := strconv.Itoa(number)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close