checker

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZeroSized added in v0.0.11

func IsZeroSized(t types.Type) bool

IsZeroSized determines whether the type t is provably zero-sized.

Types

type Checker

type Checker struct {

	// Type definitions excluded via `//nolint:zerolint` directives.
	ExcludedTypeDefs filter.Filter

	Excludes set.Set[string]

	Detected map[string]bool

	// Filter for zero-sized checks, used in [Checker.ZeroSizedType].
	Regex *regexp.Regexp
	// contains filtered or unexported fields
}

Checker provides helper functions for analyzing pointers to zero-sized types.

func (*Checker) Prepare

func (c *Checker) Prepare()

Prepare initializes the Checker with the provided [analysis.Pass], preparing for new analysis.

func (*Checker) ZeroSizedType

func (c *Checker) ZeroSizedType(t types.Type) (valueMethod, zeroSized bool)

ZeroSizedType determines whether t is a zero-sized type, considering exclusions.

It returns:

  • zeroSized: true if t is zero-sized (and not excluded).

and, if zeroSized is true:

  • valueMethod: the type has value receiver methods.

func (*Checker) ZeroSizedTypePointer

func (c *Checker) ZeroSizedTypePointer(t types.Type) (elem types.Type, valueMethod, zeroSized bool)

ZeroSizedTypePointer checks whether t is a pointer to a zero-sized type.

It returns:

  • zeroSized: true if t is a pointer to a zero-sized type (and not excluded).

and, if zeroSized is true:

  • elem: the underlying zero-sized element type of the pointer.
  • valueMethod: the element type has value receiver methods.

Jump to

Keyboard shortcuts

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