ignore

package
v0.46.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ignore decides which files to skip when packaging a project tree. It applies a built-in list of always-ignored patterns, any extras supplied by the caller, and the project's .gitignore (when present at the root).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

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

Matcher decides whether a path should be excluded from an archive.

func NewProjectMatcher

func NewProjectMatcher(root string, extraPatterns ...string) (*Matcher, error)

NewProjectMatcher returns a Matcher rooted at root. The default ignore patterns are always applied. extraPatterns are layered on top, and the root .gitignore (if present) is consulted last.

func (*Matcher) ProjectRelPath

func (m *Matcher) ProjectRelPath(absPath string) (string, error)

ProjectRelPath returns absPath relative to the matcher root using forward slashes. It is intended for callers that walk files outside the immediate project root and need a path to feed back into ShouldIgnoreWith.

func (*Matcher) ShouldIgnore

func (m *Matcher) ShouldIgnore(relPath string, isDir bool) bool

ShouldIgnore reports whether relPath should be skipped. relPath is used for both pattern matching and gitignore lookup. Use ShouldIgnoreWith when those paths differ (for example, when archiving shared files from outside the walked tree).

func (*Matcher) ShouldIgnoreWith

func (m *Matcher) ShouldIgnoreWith(patternRelPath, projectRelPath string, isDir bool) bool

ShouldIgnoreWith reports whether a path should be skipped, allowing the pattern-matching path and the project-relative path used for .gitignore lookup to differ.

Jump to

Keyboard shortcuts

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