Documentation
¶
Overview ¶
Package uniq exposes primitives for detecting files with duplicate checksums from a list of file paths.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
FollowSymlinks bool // Follow symbolic links.
Recursive bool // Recurse if reading from a directory.
ExitOnError bool // Stop if an error occurs.
ExitOnDup bool // Stop if a file with a previously-seen checksum is found.
Cancel <-chan struct{} // Close to signal cancellation.
UniqWriter io.Writer // Write paths of files with previously-unseen checksums.
DupWriter io.Writer // Write paths of files with previously-seen checksums.
ErrWriter io.Writer // Write errors.
// contains filtered or unexported fields
}
Options groups configuration options for Filter and FilterDir.
type Sums ¶
type Sums struct {
// contains filtered or unexported fields
}
Sums is a map of checksums to files that is safe for concurrent access from multiple goroutines.
func Filter ¶
Filter reads newline-delimited file paths from r, evaluates each file in search of duplicate checksums, and returns a *Sums and any error(s) that may have occurred during evaluation. If err is non-nil, its type will be Errors.
func FilterDir ¶
FilterDir is like Filter except it reads file paths from the directory located at path.
func (*Sums) Append ¶
Append stores file in the set of files under checksum sum. Append does not attempt to verify whether sum is a valid checksum for file. Append returns false if file is the first encountered for sum, true otherwise.
func (*Sums) Get ¶
Get returns the list of files for sum. ok will be false if s does not contain any files for sum, true otherwise.
func (*Sums) Range ¶
Range calls f sequentially for each sum and set of files present in s. If f returns false, Range stops the iteration. If s is modified concurrently, Range may reflect any mapping for a given key during the Range call.