Documentation
¶
Overview ¶
Package packagelevelmutableslicemap implements a Go analysis linter that flags package-level (file/package-scope) var declarations of slices or maps that are mutated from inside a function body via append re-assignment, index assignment, or delete().
Package-level mutable slices/maps are shared across every goroutine and every call into the package for the lifetime of the process. Mutating one from inside a function — rather than storing the state on a struct or returning fresh values — risks data races under concurrent access and can leak state between unrelated calls.
Mutations inside a top-level init() function are not reported: init runs exactly once before any other code, so it is the idiomatic place to populate package-level state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Analyzer = analyzerutil.New("packagelevelmutableslicemap", "reports mutation of package-level slice/map variables from inside function bodies, which risks data races and cross-call state leaks", run)
Analyzer is the package-level-mutable-slice-map analysis pass.
Functions ¶
This section is empty.
Types ¶
This section is empty.