sourceignore

package
v0.39.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of the ignore file
	IgnoreFilename = ".sourceignore"
	// Default ignore patterns for version control system files
	ExcludeVCS = ".git/,.gitignore,.gitmodules,.gitattributes"
	// Default ignore patterns for the CI/CD process
	ExcludeCI = "" /* 127-byte string literal not displayed */
	// Additional default ignore patterns
	ExcludeExtra = "**/.goreleaser.yml,**/.goreleaser.brew.yml,**/.sops.yaml,**/.flux.yaml,**/.golangci.yaml"
)

Variables

View Source
var ErrIgnoreFileExists = fmt.Errorf("%s file  already exists", IgnoreFilename)

ErrIgnoreFileExists is returned when the ignore file already exists when attempting to create it

Functions

func CreateIgnoreFile

func CreateIgnoreFile(dir, ignoreFileName string, ignorePatternStrings []string) error

CreateIgnoreFile creates a new ignore file at the given directory

func DefaultPatterns

func DefaultPatterns(domain []string) []gitignore.Pattern

DefaultPatterns returns a gitignore.Pattern slice with the default ExcludeCI, ExcludeExtra patterns.

func NewDefaultMatcher

func NewDefaultMatcher(ps []gitignore.Pattern, domain []string) gitignore.Matcher

NewDefaultMatcher returns a gitignore.Matcher with the DefaultPatterns as lowest priority patterns.

func NewMatcher

func NewMatcher(ps []gitignore.Pattern) gitignore.Matcher

NewMatcher returns a gitignore.Matcher for the given gitignore.Pattern slice. It mainly exists to compliment the API.

func ReadIgnoreFile

func ReadIgnoreFile(path string, domain []string) ([]gitignore.Pattern, error)

ReadIgnoreFile attempts to read the file at the given path and returns the read patterns.

func ReadPatterns

func ReadPatterns(reader io.Reader, domain []string) []gitignore.Pattern

ReadPatterns collects ignore patterns from the given reader and returns them as a gitignore.Pattern slice. If a domain is supplied, this is used as the scope of the read patterns.

func VCSPatterns

func VCSPatterns(domain []string) []gitignore.Pattern

VCSPatterns returns a gitignore.Pattern slice with ExcludeVCS patterns.

Types

type IgnoreFilter

type IgnoreFilter func(p string, fi os.FileInfo) bool

IgnoreFilter ignores certain files based on a list of patterns and domain.

func IgnoreFileFilter

func IgnoreFileFilter(ps []gitignore.Pattern, domain []string) IgnoreFilter

IgnoreFileFilter returns a IgnoreFilter that ignores certain files based on a list of patterns and domain.

Jump to

Keyboard shortcuts

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