Documentation
¶
Overview ¶
pkg/walker/walker.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Violation ¶
type Violation struct {
// contains filtered or unexported fields
}
Violation represents a single import rule violation.
func (Violation) ImportPath ¶
func (Violation) RuleDescription ¶
type ViolationsError ¶
type ViolationsError struct {
// contains filtered or unexported fields
}
ViolationsError is a collection of violations. Note: This is not an "error" in the Go sense unless the caller decides to wrap/return it as one. The CLI can print details and then return a sentinel error.
func (ViolationsError) Len ¶
func (ve ViolationsError) Len() int
func (ViolationsError) Violations ¶
func (ve ViolationsError) Violations() iter.Seq[Violation]
Violations returns an iterator over violations so callers can `range` over it.
type Walker ¶
type Walker struct {
// contains filtered or unexported fields
}
func NewWalker ¶
NewWalker creates a Walker by locating go.mod from startPath and reading its module path. startPath can be ".", "./foobar", or any path inside the target module.
func (*Walker) Walk ¶
Walk walks through Go files under the given roots, checks import rules, and returns a ViolationsError if any rule is violated.
- roots are filesystem paths (e.g. ".", "./foobar", "internal"). - Import path normalization is computed relative to the module root directory. - If ctx is nil, the Walker's context (set in NewWalker) is used.