Documentation ¶
Overview ¶
Package filecheck helps tests check permissions and ownership of on-disk files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check(ctx context.Context, root string, pats []*Pattern) ( problems map[string][]string, numPaths int, err error)
Check inspects all files within (and including) root. pats are executed in-order against each path. If a pattern matches a path, no later patterns are evaluated against it. If SkipChildren is included in a pattern , any matched directories' children are skipped. A map from absolute path names to strings describing problems is returned, along with the number of paths (not including ones skipped by SkipChildren) that were inspected.
Types ¶
type Matcher ¶
Matcher matches a path relative to the root passed to Check.
func Path ¶
Path returns a Matcher that matches only the supplied path (relative to the root passed to Check).
func PathRegexp ¶
PathRegexp returns a Matcher that matches all paths matched by regular expression r. r is evaluated against paths relative to the root passed to Check.
type Option ¶
type Option func(*Pattern)
Option is used to configure a Pattern.
func Groups ¶
Groups returns options that permit a path to be owned by any of the supplied groups (all of which must exist).
func Mode ¶
Mode requires that permission-related bits in the path's mode exactly match m. Only 0777, setuid, setgid, and the sticky bit may be supplied.
func NotMode ¶
NotMode requires that the permission-related bits in the path's mode contain none of the bits in nm. Only 0777, setuid, setgid, and the sticky bit may be supplied.
func SkipChildren ¶
func SkipChildren() Option
SkipChildren indicates that any child paths should not be checked. The directory itself will still be checked. This has no effect for non-directories.
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern matches one or more paths. It can be used to verify that matched paths have expected ownership and permissions.
func NewPattern ¶
NewPattern returns a new Pattern that verifies that paths matched by m meet the requirements specified by rs.