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
Fix CGO unit failures from typeassertionnil registry drift (#64919)
Synchronize analyzer documentation and spec coverage, and record the pending cross-platform CI enforcement audit.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: pkg/linters/README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,7 @@ This package currently provides custom Go analyzers in the following subpackages
73
73
-`timenowsub` — reports `time.Now().Sub(t)` calls that should be simplified to `time.Since(t)`.
74
74
-`tolowerequalfold` — reports case-insensitive string comparisons using `strings.ToLower`/`ToUpper` that should use `strings.EqualFold`.
75
75
-`trimleftright` — reports `strings.TrimLeft`/`TrimRight` calls with a multi-character literal cutset where `TrimPrefix`/`TrimSuffix` was likely intended.
76
+
-`typeassertionnil` — reports single-value type assertions to pointer types and recommends the two-value form.
76
77
-`typeassertionokdiscarded` — reports two-value type assertions whose `ok` result is discarded.
77
78
-`uncheckedsliceindex` — reports slice and string indexes without proven bounds checks.
78
79
-`uncheckedtypeassertion` — reports single-value type assertions where unchecked panics are possible.
@@ -175,6 +176,7 @@ environment variable and gates findings on the recorded execution hit count for
175
176
|`timenowsub`| Custom `go/analysis` analyzer that flags `time.Now().Sub(t)` calls that should use `time.Since(t)`|
176
177
|`tolowerequalfold`| Custom `go/analysis` analyzer that flags case-insensitive comparisons via `strings.ToLower`/`ToUpper` that should use `strings.EqualFold`|
177
178
|`trimleftright`| Custom `go/analysis` analyzer that flags `strings.TrimLeft`/`TrimRight` calls with a multi-character literal cutset where `TrimPrefix`/`TrimSuffix` was likely intended |
179
+
|`typeassertionnil`| Custom `go/analysis` analyzer that flags single-value type assertions to pointer types and recommends the two-value form |
178
180
|`typeassertionokdiscarded`| Custom `go/analysis` analyzer that flags two-value type assertions whose `ok` result is discarded |
179
181
|`uncheckedsliceindex`| Custom `go/analysis` analyzer that reports slice and string indexes without proven bounds checks |
180
182
|`uncheckedtypeassertion`| Custom `go/analysis` analyzer that flags unchecked single-value type assertions |
- The package is intentionally organized as a namespace (`pkg/linters/*`) so individual analyzers remain isolated and independently testable.
338
343
- CI currently enforces the `errstringmatch`, `manualmutexunlock`, `panicinlibrarycode`, `osexitinlibrary`, and `rawloginlib` analyzers via `.github/workflows/cgo.yml`.
344
+
-`typeassertionnil` is registered but excluded from CI enforcement pending a cross-platform enforcement-readiness audit.
339
345
-`excessivefuncparams` exposes a `-max-params` analyzer flag and defaults to `8` parameters (`DefaultMaxParams`).
340
346
-`largefunc` exposes a `-max-lines` analyzer flag, defaults to `60` lines (`DefaultMaxLines`), and skips `_test.go` files.
341
347
-`osexitinlibrary` helps enforce separation between library logic and process-level termination.
0 commit comments