filediff

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Old string
	New string
}

Diff represents the diff between two files.

func (Diff) Pretty

func (diff Diff) Pretty(w io.Writer)

Pretty will print the diff.

type Files

type Files map[string]string

func ReadFiles

func ReadFiles(root string) (Files, error)

ReadFiles reads all files under the specified directory.

func (Files) Save

func (files Files) Save() error

Save saves the outputs to the specified directory.

type Result

type Result struct {
	Created   []string
	Deleted   []string
	Unchanged []string
	Diffs     map[string]Diff
}

Result represents the diff result.

func FileDiff

func FileDiff(sources Files, targets Files) (*Result, error)

FileDiff compare the actual outputs with the snapshot.

func (Result) HasChanged

func (r Result) HasChanged() bool

HasChanged returns true if the result has any changes.

func (Result) Pretty

func (r Result) Pretty(w io.Writer)

Pretty will print the diff result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL