Skip to content

no-init

Default severity: note

Configuration: severity and path excludes

Reports package init functions. Initialization functions hide side effects and ordering constraints from callers, which makes packages harder to test and compose.

func init() {
registerHandlers()
}
func RegisterHandlers(registry *Registry) error {
return registry.Register(defaultHandlers())
}

Call explicit setup from main, a constructor, or the test that needs it. Explicit setup can return errors and makes dependencies visible.

//strider:ignore no-init
func init() {
// Required by an integration contract that cannot call setup explicitly.
}