Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoDiff = errors.New("no diff found")
Functions ¶
Types ¶
type DiffNode ¶
type DiffNode struct {
Source1 string `json:"source1"`
Source2 string `json:"source2"`
UnifiedDiff *string `json:"unified_diff,omitempty"`
Comments []string `json:"comments,omitempty"`
Details []DiffNode `json:"details,omitempty"` // Recursive nodes
}
DiffNode represents a single node in the difference tree. Intended for approximate compatibility with diffoscope's JSON schema.
func (*DiffNode) Status ¶
func (n *DiffNode) Status() NodeStatus
Status determines the status of a node from its comments.
type File ¶
type File struct {
Name string
Reader io.ReadSeeker
}
File represents an input file with its name and content reader
type FileType ¶
type FileType int
FileType defines the identified file type
const ( // TypeBinary represents an unidentified binary file TypeBinary FileType = iota // TypeText represents an unidentified text file TypeText // TypeGzip represents a Gzip compressed file TypeGzip // TypeZip represents a Zip archive TypeZip // TypeTar represents a Tar archive (specifically ustar) TypeTar )
func DetectFileType ¶
func DetectFileType(r io.ReadSeeker) (FileType, error)
DetectFileType checks the magic bytes of a reader to identify its type.
type NodeStatus ¶
type NodeStatus int
NodeStatus indicates whether a node represents a file only in first archive, only in second archive, or in both.
const ( StatusBoth NodeStatus = iota StatusOnlyFirst StatusOnlySecond )
type Options ¶
type Options struct {
Output io.Writer // If non-nil, write formatted text diff here
OutputJSON io.Writer // If non-nil, write JSON diff here
OutputNode *DiffNode // If non-nil, populated with the diff tree structure
MaxDepth int // Maximum archive nesting depth to recurse into (0 = unlimited)
}
Options for the Diff function
Click to show internal directories.
Click to hide internal directories.