Reputation: 121
It seems gofmt in go1.19 changed its behavior to not allowing indenting based on some heuristics (from go docs: https://tip.golang.org/doc/comment). But this breaks the TODO comment formatting.
This is what I used to have in my code that gofmt accepted.
// TODO: Do some stuff. And this is a long comment so it'll need to
// be wrapped. This is the next line.
Running gofmt gives me this:
// TODO: Do some stuff. And this is a long comment so it'll need to
//
// be wrapped. This is the next line.
I could change it to this but then GoLand doesn't display the TODO properly.
// TODO: Do some stuff. And this is a long comment so it'll need to
// be wrapped. This is the next line.
Any ideas on how to reconcile these problems? I don't understand why the accepted style for TODO has changed.
Upvotes: 8
Views: 1295
Reputation: 48476
The custom pattern I used to recognize TODO
is
\/(\/|\*)[ ]*\btodo\b(.|\n)*(\*\/|)
Here are steps to set it in Goland
Upvotes: 2