Skip to content

Go linter that flags panic() call that don't have a comment explaining why panic

License

Notifications You must be signed in to change notification settings

ldemailly/panic-linter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Go linter that flags panic() call that don't have a comment explaining why panic

Topics

Resources

License

Stars

Watchers

Forks