Documentation ¶
Index ¶
- func CopyFile(src, dst string) (int64, error)
- func CreateIfNotExists(path string, isDir bool) error
- func GetTotalUsedFds() int
- func Matches(file string, patterns []string) (bool, error)
- func MatchesOrParentMatches(file string, patterns []string) (bool, error)
- func ReadSymlinkedDirectory(path string) (string, error)
- type MatchInfo
- type Pattern
- type PatternMatcher
- func (pm *PatternMatcher) Exclusions() bool
- func (pm *PatternMatcher) Matches(file string) (bool, error)deprecated
- func (pm *PatternMatcher) MatchesOrParentMatches(file string) (bool, error)
- func (pm *PatternMatcher) MatchesUsingParentResult(file string, parentMatched bool) (bool, error)deprecated
- func (pm *PatternMatcher) MatchesUsingParentResults(file string, parentMatchInfo MatchInfo) (bool, MatchInfo, error)
- func (pm *PatternMatcher) Patterns() []*Pattern
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
CopyFile copies from src to dst until either EOF is reached on src or an error occurs. It verifies src exists and removes the dst if it exists.
func CreateIfNotExists ¶
CreateIfNotExists creates a file or a directory only if it does not already exist.
func GetTotalUsedFds ¶
func GetTotalUsedFds() int
GetTotalUsedFds Returns the number of used File Descriptors by reading it via /proc filesystem.
func Matches ¶
Matches returns true if file matches any of the patterns and isn't excluded by any of the subsequent patterns.
This implementation is buggy (it only checks a single parent dir against the pattern) and will be removed soon. Use MatchesOrParentMatches instead.
func MatchesOrParentMatches ¶
MatchesOrParentMatches returns true if file matches any of the patterns and isn't excluded by any of the subsequent patterns.
func ReadSymlinkedDirectory ¶
ReadSymlinkedDirectory returns the target directory of a symlink. The target of the symbolic link may not be a file.
Types ¶
type MatchInfo ¶
type MatchInfo struct {
// contains filtered or unexported fields
}
MatchInfo tracks information about parent dir matches while traversing a filesystem.
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern defines a single regexp used to filter file paths.
type PatternMatcher ¶
type PatternMatcher struct {
// contains filtered or unexported fields
}
PatternMatcher allows checking paths against a list of patterns
func NewPatternMatcher ¶
func NewPatternMatcher(patterns []string) (*PatternMatcher, error)
NewPatternMatcher creates a new matcher object for specific patterns that can be used later to match against patterns against paths
func (*PatternMatcher) Exclusions ¶
func (pm *PatternMatcher) Exclusions() bool
Exclusions returns true if any of the patterns define exclusions
func (*PatternMatcher) Matches
deprecated
func (pm *PatternMatcher) Matches(file string) (bool, error)
Matches returns true if "file" matches any of the patterns and isn't excluded by any of the subsequent patterns.
The "file" argument should be a slash-delimited path.
Matches is not safe to call concurrently.
Deprecated: This implementation is buggy (it only checks a single parent dir against the pattern) and will be removed soon. Use either MatchesOrParentMatches or MatchesUsingParentResults instead.
func (*PatternMatcher) MatchesOrParentMatches ¶
func (pm *PatternMatcher) MatchesOrParentMatches(file string) (bool, error)
MatchesOrParentMatches returns true if "file" matches any of the patterns and isn't excluded by any of the subsequent patterns.
The "file" argument should be a slash-delimited path.
Matches is not safe to call concurrently.
func (*PatternMatcher) MatchesUsingParentResult
deprecated
func (pm *PatternMatcher) MatchesUsingParentResult(file string, parentMatched bool) (bool, error)
MatchesUsingParentResult returns true if "file" matches any of the patterns and isn't excluded by any of the subsequent patterns. The functionality is the same as Matches, but as an optimization, the caller keeps track of whether the parent directory matched.
The "file" argument should be a slash-delimited path.
MatchesUsingParentResult is not safe to call concurrently.
Deprecated: this function does behave correctly in some cases (see https://github.com/docker/buildx/issues/850).
Use MatchesUsingParentResults instead.
func (*PatternMatcher) MatchesUsingParentResults ¶
func (pm *PatternMatcher) MatchesUsingParentResults(file string, parentMatchInfo MatchInfo) (bool, MatchInfo, error)
MatchesUsingParentResults returns true if "file" matches any of the patterns and isn't excluded by any of the subsequent patterns. The functionality is the same as Matches, but as an optimization, the caller passes in intermediate results from matching the parent directory.
The "file" argument should be a slash-delimited path.
MatchesUsingParentResults is not safe to call concurrently.
func (*PatternMatcher) Patterns ¶
func (pm *PatternMatcher) Patterns() []*Pattern
Patterns returns array of active patterns