Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrScanCancelled = errors.New("the scan has been cancelled")
ErrScanCancelled is reported by FileIter.Err() if it's been cancelled.
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir string
Dir is a file directory path accessible via operating system API acalls.
type File ¶
type File struct { // Scanned file location Root Dir Path string Index int Skipped bool // Error handling Err error // FileInfo values collected during a scan (may be empty) Name string Size int64 Mode fs.FileMode ModTime time.Time // File performance results Start, End time.Time }
File describes a file that has been scanned.
type FileIter ¶
type FileIter struct {
// contains filtered or unexported fields
}
FileIter is a file iterator returned by a Scanner. It's used to step through the results of a Scanner as they're produced.
func (*FileIter) Err ¶
Err returns a non-nil error if the iterator's job encountered an error and stopped. It should be called after Scan() returns false. It returns nil if the job completed successfully.
func (*FileIter) File ¶
File returns the most recently matched file. It is updated each time Scan() returns true. Scan() must be called at least once before calling this funcion.
type JobStats ¶
type JobStats struct { // ElapsedRead is the total time spent reading files. ElapsedRead time.Duration // TotalBytes is the total number of bytes read. TotalBytes int64 // Read is the number of files read without issue. Read int // Errors is the number of files that encountered an error. Errors int // Scanned is the number of files scanned. Scanned int // Skipped is the number of files not scanned due to filters. Skipped int }
JobStats report scanning tallies during and at the completion of scanning.
type Pattern ¶
Pattern is a file matching pattern based on regular expressions.
func (*Pattern) UnmarshalText ¶
UnmarshalText unmarshals the given text as a pattern in p.
type Scanner ¶
type Scanner struct { // Include is a filter that limits the number of files scanned. If // provided, only files with names matching at least one pattern will // be scanned. Include []Pattern // Exclude is a filter that limits the number of files scanned. If // provided, only files with names that don't match any of its patterns // will be scanned. Exclude []Pattern }
Scanner scans a set of files for issues identified by its issue handlers.