Intellij shows incorrect suggestion for Go string interpolation for fmt.Printf()


The actual code is

Intellij shows this hint for this code:

This hint is not even correct Go code as far as I can tell.  Why is it showing this?

Official comment

Code Folding provides the following hint. You can disable it via Preferences/Settings | Editor | General | Code Folding | Go.

I don't see how it could be code folding because it's one line.  And the suggestion shown is incorrect Go code.


Under Preferences/Settings | Editor | General | Code Folding | Go you can find several entries:

  • One line returns
  • One line panics
  • Format strings

In your particular case, Format strings option folds your code inside fmt.Printf() function and you can unfold it by clicking on the string

The following folding is helpful to view arguments as values, fox example:

fmt.Errorf("line: %d, column: %d", 1, 2)

Will show:

line: #{1}, column: #{2}

I hope it helps.


That code folding is annoying.


Please sign in to leave a comment.