Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ldemailly/panic-linter
Go linter that flags panic() call that don't have a comment explaining why panic
https://github.com/ldemailly/panic-linter
go golang golang-linter linter
Last synced: 17 days ago
JSON representation
Go linter that flags panic() call that don't have a comment explaining why panic
- Host: GitHub
- URL: https://github.com/ldemailly/panic-linter
- Owner: ldemailly
- License: apache-2.0
- Created: 2024-10-07T23:47:09.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T23:57:41.000Z (about 1 month ago)
- Last Synced: 2024-11-13T00:30:41.410Z (about 1 month ago)
- Topics: go, golang, golang-linter, linter
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/ldemailly/panic-linter)](https://goreportcard.com/report/github.com/ldemailly/panic-linter)
[![GoDoc](https://godoc.org/github.com/ldemailly/panic-linter?status.svg)](https://pkg.go.dev/github.com/ldemailly/panic-linter)
[![codecov](https://codecov.io/gh/ldemailly/panic-linter/branch/main/graph/badge.svg)](https://codecov.io/gh/ldemailly/panic-linter)
[![CI Checks](https://github.com/ldemailly/panic-linter/actions/workflows/include.yml/badge.svg)](https://github.com/ldemailly/panic-linter/actions/workflows/include.yml)# 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:
```go
panic("catch this")
```good:
```go
panic(fmt.Sprintf("bug: unexpected input=%v because...", input)) // Shouldn't happen unless we have bug
```