gocapsule

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:      "gocapsule",
	Doc:       "enforces encapsulation by preventing direct struct creation, type conversion, and field reassignment when New** constructors exist",
	Run:       run,
	Requires:  []*analysis.Analyzer{inspect.Analyzer},
	FactTypes: []analysis.Fact{new(EncapsulatedType)},
}

Analyzer is the gocapsule analyzer that enforces encapsulation.

Functions

func New

func New(settings any) (register.LinterPlugin, error)

New creates a new gocapsule plugin instance for golangci-lint.

Types

type EncapsulatedType added in v0.2.0

type EncapsulatedType struct {
	ConstructorName string
}

EncapsulatedType is a Fact indicating that a type (struct or defined type) has a corresponding New** constructor and should not be directly instantiated or have its fields reassigned from external packages.

func (*EncapsulatedType) AFact added in v0.2.0

func (*EncapsulatedType) AFact()

AFact implements the analysis.Fact interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL