Home

Awesome

Go Report Card GoDoc codecov CI Checks

panic-linter

paniccheck is a golang linter that flags panic() call that don't have a comment explaining why panic.

https://go.dev/wiki/CodeReviewComments#dont-panic

Why?

panic should only be used very sparingly, for catching bugs basically, and thus deserve a comment to confirm that that's indeed the case

bad:

  panic("catch this")

good:

  panic(fmt.Sprintf("bug: unexpected input=%v because...", input)) // Shouldn't happen unless we have bug