Skip to content

constructor-interface-return

Detect constructors that hide a single concrete result.

Updated View as Markdown

Default severity: warning

Reports only exported New-style constructors whose returns consistently reveal one local concrete implementation of a non-empty local interface. Polymorphic, standard-library, empty, and error interfaces are skipped.

Bad

func NewStore() Store {
	return &memoryStore{}
}

Good

func NewStore() *memoryStore {
	return &memoryStore{}
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close