fix comment and variable name typos

This commit is contained in:
Michael Eischer
2026-05-16 16:52:50 +02:00
parent fa1a318780
commit 10645ccd2a
17 changed files with 34 additions and 30 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
// Package filter implements filters for files similar to filepath.Glob, but
// in contrast to filepath.Glob a pattern may specify directories.
// Package filter implements path filters similar to filepath.Match, but
// patterns may span multiple path components and use a recursive "**" wildcard.
//
// For a list of valid patterns please see the documentation on filepath.Glob.
// Single-component wildcards follow filepath.Match rules; see Match for details.
package filter
+11 -7
View File
@@ -7,8 +7,8 @@ import (
"github.com/restic/restic/internal/errors"
)
// ErrBadString is returned when Match is called with the empty string as the
// second argument.
// ErrBadString is returned when an empty path string is passed to prepareStr
// (used by Match, ChildMatch, List, and ListWithChild).
var ErrBadString = errors.New("filter.Match: string is empty")
type patternPart struct {
@@ -65,9 +65,10 @@ func splitPath(p string) []string {
return parts
}
// Match returns true if str matches the pattern. When the pattern is
// Match reports whether str matches the pattern. When the pattern is
// malformed, filepath.ErrBadPattern is returned. The empty pattern matches
// everything, when str is the empty string ErrBadString is returned.
// Patterns prefixed with "!" are not supported; use List or ListWithChild.
//
// Pattern can be a combination of patterns suitable for filepath.Match, joined
// by filepath.Separator.
@@ -90,9 +91,10 @@ func Match(patternStr, str string) (matched bool, err error) {
return match(pattern, strs)
}
// ChildMatch returns true if children of str can match the pattern. When the pattern is
// ChildMatch reports whether children of str can match the pattern. When the pattern is
// malformed, filepath.ErrBadPattern is returned. The empty pattern matches
// everything, when str is the empty string ErrBadString is returned.
// Patterns prefixed with "!" are not supported; use List or ListWithChild.
//
// Pattern can be a combination of patterns suitable for filepath.Match, joined
// by filepath.Separator.
@@ -266,18 +268,20 @@ func ParsePatterns(pattern []string) []Pattern {
return patpat
}
// List returns true if str matches one of the patterns. Empty patterns are ignored.
// List reports whether str matches one of the patterns. Empty patterns are ignored.
func List(patterns []Pattern, str string) (matched bool, err error) {
matched, _, err = list(patterns, false, str)
return matched, err
}
// ListWithChild returns true if str matches one of the patterns. Empty patterns are ignored.
// ListWithChild reports whether str matches one of the patterns and whether child
// paths might still match. Empty patterns are ignored.
func ListWithChild(patterns []Pattern, str string) (matched bool, childMayMatch bool, err error) {
return list(patterns, true, str)
}
// list returns true if str matches one of the patterns. Empty patterns are ignored.
// list reports whether str matches one of the patterns and, when checkChildMatches is
// true, whether child paths might still match. Empty patterns are ignored.
// Patterns prefixed by "!" are negated: any matching file excluded by a previous pattern
// will become included again.
func list(patterns []Pattern, checkChildMatches bool, str string) (matched bool, childMayMatch bool, err error) {
+2 -2
View File
@@ -75,7 +75,7 @@ func (opts IncludePatternOptions) CollectPatterns(warnf func(msg string, args ..
return fs, nil
}
// IncludeByPattern returns a IncludeByNameFunc which includes files that match
// IncludeByPattern returns an IncludeByNameFunc which includes files that match
// one of the patterns.
func IncludeByPattern(patterns []string, warnf func(msg string, args ...interface{})) IncludeByNameFunc {
parsedPatterns := ParsePatterns(patterns)
@@ -89,7 +89,7 @@ func IncludeByPattern(patterns []string, warnf func(msg string, args ...interfac
}
}
// IncludeByInsensitivePattern returns a IncludeByNameFunc which includes files that match
// IncludeByInsensitivePattern returns an IncludeByNameFunc which includes files that match
// one of the patterns, ignoring the casing of the filenames.
func IncludeByInsensitivePattern(patterns []string, warnf func(msg string, args ...interface{})) IncludeByNameFunc {
lowerPatterns := make([]string, len(patterns))