Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# noinlineerr

A go linter that forbids inline error handling using `if err := ...; err != nil`.
A Go linter that forbids inline error handling using `if err := ...; err != nil`.

---

## Why?
Inline error handling in Go can hurt readibility by hiding the actual function call behind error plubming.
We believe errors and function deserve their own spotlight.
Inline error handling in Go can hurt readability by hiding the actual function call behind error plumbing.
We believe errors and functions deserve their own spotlight.

Instead of:
```go
if err := doSomething(); err != nil {
return err
}
```
Prefer more explicit and readable:
Prefer the more explicit and readable:
```go
err := doSomething()
if err != nil {
Expand All @@ -37,7 +37,7 @@ go install github.com/AlwxSin/noinlineerr/cmd/noinlineerr@latest
noinlineerr ./...
```

⚠️ Note: the linter detects inline error assignments only when the error variable is explicitly typed or deducible. It doesn't handle dynamically typed interfaces (e.g. foo().Err() where Err() returns error via interface).
⚠️ Note: The linter detects inline error assignments only when the error variable is explicitly typed or deducible. It doesn't handle dynamically typed interfaces (e.g., `foo().Err()` where `Err()` returns an error via an interface).

---

Expand All @@ -51,4 +51,4 @@ Test data lives under `testdata/src/...`
---

## Contributing
PRs welcome. Let's make Go code cleaner, one `err` at a time.
PRs are welcome. Let's make Go code cleaner, one `err` at a time.