Help us shape the future of Go! Take the 2026 Go Developer Survey

ignore

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Code generated by generate_rules.py. DO NOT EDIT.

Package ignore provides file/directory pattern matching for exclusion

This package handles advanced file/directory exclusion patterns based on multiple criteria including .gitignore rules, hidden files, and custom patterns. It uses the functional options pattern for configuration.

Package ignore provides file/directory pattern matching for exclusion

Index

Constants

This section is empty.

Variables

View Source
var DefaultIgnorePatterns = []string{}/* 183 elements not displayed */

DefaultIgnorePatterns contains the standard default ignore rules.

Functions

func IsIgnored

func IsIgnored(matcher *IgnoreMatcher, path string, isDir bool) bool

Types

type Config

type Config struct {
	RootDir       string
	IgnoreHidden  bool
	IgnoreGit     bool
	RecursiveMode bool
	CustomRules   []string
	Logger        utils.Logger
	Disabled      bool
}

Config holds configuration options for the ignore matcher

type IgnoreMatcher

type IgnoreMatcher struct {
	// contains filtered or unexported fields
}

IgnoreMatcher determines whether a file or directory should be ignored

func CreateDisabledMatcher

func CreateDisabledMatcher() *IgnoreMatcher

func New

func New(rootDir string, opts ...Option) (*IgnoreMatcher, error)

func NewDefaultMatcher

func NewDefaultMatcher(rootDir string) (*IgnoreMatcher, error)

func NewFromConfig

func NewFromConfig(cfg Config) (*IgnoreMatcher, error)

func (*IgnoreMatcher) ClassifyVisibility

func (m *IgnoreMatcher) ClassifyVisibility(relativePath string, isDir bool) Visibility

ClassifyVisibility reports hidden and repository-gitignore metadata without applying those matches as filters.

func (*IgnoreMatcher) ShouldIgnore

func (m *IgnoreMatcher) ShouldIgnore(relativePath string, isDir bool) bool

ShouldIgnore checks if a file or directory should be ignored

type Option

type Option func(*IgnoreMatcher)

func WithCustomRules

func WithCustomRules(patterns []string) Option

func WithDisabled

func WithDisabled(disabled bool) Option

func WithGitIgnore

func WithGitIgnore(ignore bool) Option

func WithHiddenIgnore

func WithHiddenIgnore(ignore bool) Option

func WithLogger

func WithLogger(logger utils.Logger) Option

func WithRecursive

func WithRecursive(recursive bool) Option

type Visibility

type Visibility struct {
	Hidden       bool
	GitIgnored   bool
	ProtectedGit bool
}

Visibility describes presentation-relevant ignore metadata. Explicit and custom safety exclusions remain hard filters and are not represented here.

Jump to

Keyboard shortcuts

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