Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LevenshteinDistance ¶
LevenshteinDistance calculates the edit distance between two strings. This is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector aggregates multiple errors during validation. It handles deduplication, sorting, and limiting the number of errors returned.
func NewCollector ¶
func NewCollector() *Collector
NewCollector creates a new error collector with no limit.
func NewCollectorWithLimit ¶
NewCollectorWithLimit creates a new error collector with a maximum error limit. Once the limit is reached, additional errors are counted but not stored.
func (*Collector) Add ¶
Add adds an error to the collector. Duplicate errors (same code + location) are automatically deduplicated.
func (*Collector) Count ¶
Count returns the total number of unique errors added to the collector. This may be higher than len(Errors()) if deduplication or truncation occurred.
func (*Collector) Errors ¶
Errors returns all collected errors, sorted by location. Sorting order: file (alphabetically), line (numerically), column (numerically). Errors without location come last.
type Suggester ¶
type Suggester struct {
// contains filtered or unexported fields
}
Suggester generates "did you mean?" suggestions for typos.
func NewSuggester ¶
func NewSuggester() *Suggester
NewSuggester creates a new suggestion engine with default settings.
func (*Suggester) FormatSuggestion ¶
FormatSuggestion creates a formatted error message with suggestions. Returns empty string if no good suggestions are found.