You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add lints for unclosed files and fix numerous lints in tests (#18998)
Add the temp file lints needed to catch the locked file issue I had on
Windows tests here #18197. Also
fixes a bunch of other lints that were masked for tests.
Copy file name to clipboardExpand all lines: agents.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,3 +55,17 @@ Erigon is a high-performance Ethereum execution client with embedded consensus l
55
55
Commit messages: prefix with package(s) modified, e.g., `eth, rpc: make trace configs optional`
56
56
57
57
**Important**: Always run `make lint` after making code changes and before committing. Fix any linter errors before proceeding.
58
+
59
+
## Lint Notes
60
+
61
+
The linter (`make lint`) is non-deterministic in which files it scans — new issues may appear on subsequent runs. Run lint repeatedly until clean.
62
+
63
+
Common lint categories and fixes:
64
+
-**ruleguard (defer tx.Rollback/cursor.Close):** The error check must come *before*`defer tx.Rollback()`. Never remove an explicit `.Close()` or `.Rollback()` — add `defer` as a safety net alongside it, since the timing of the explicit call may matter.
65
+
-**prealloc:** Pre-allocate slices when the length is known from a range.
66
+
-**unslice:** Remove redundant `[:]` on variables that are already slices.
67
+
-**newDeref:** Replace `*new(T)` with `T{}`.
68
+
-**appendCombine:** Combine consecutive `append` calls into one.
69
+
-**rangeExprCopy:** Use `&x` in `range` to avoid copying large arrays.
70
+
-**dupArg:** For intentional `x.Equal(x)` self-equality tests, suppress with `//nolint:gocritic`.
71
+
-**Loop ruleguard in benchmarks:** For `BeginRw`/`BeginRo` inside loops where `defer` doesn't apply, suppress with `//nolint:gocritic`.
0 commit comments