Documentation
¶
Index ¶
- Constants
- Variables
- func CreateIgnoreFile(dir, ignoreFileName string, ignorePatternStrings []string) error
- func DefaultPatterns(domain []string) []gitignore.Pattern
- func NewDefaultMatcher(ps []gitignore.Pattern, domain []string) gitignore.Matcher
- func NewMatcher(ps []gitignore.Pattern) gitignore.Matcher
- func ReadIgnoreFile(path string, domain []string) ([]gitignore.Pattern, error)
- func ReadPatterns(reader io.Reader, domain []string) []gitignore.Pattern
- func VCSPatterns(domain []string) []gitignore.Pattern
- type IgnoreFilter
Constants ¶
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 ¶
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 ¶
CreateIgnoreFile creates a new ignore file at the given directory
func DefaultPatterns ¶
DefaultPatterns returns a gitignore.Pattern slice with the default ExcludeCI, ExcludeExtra patterns.
func NewDefaultMatcher ¶
NewDefaultMatcher returns a gitignore.Matcher with the DefaultPatterns as lowest priority patterns.
func NewMatcher ¶
NewMatcher returns a gitignore.Matcher for the given gitignore.Pattern slice. It mainly exists to compliment the API.
func ReadIgnoreFile ¶
ReadIgnoreFile attempts to read the file at the given path and returns the read patterns.
func ReadPatterns ¶
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 ¶
VCSPatterns returns a gitignore.Pattern slice with ExcludeVCS patterns.
Types ¶
type IgnoreFilter ¶
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.