Package diff
provides a wrapper around the diff
program.
import "github.com/debspencer/diff"
- Variables
- func DiffBuffer(file1 Buffer, file2 Buffer) ([]byte, error)
- func DiffFile(file1, file2 string) ([]byte, error)
- func DiffFileCommand(file1, file2, program, args string) ([]byte, error)
- type Buffer
var (
DiffProgram = "diff"
DiffProgramArgs = "-u %f1 %f2"
TempDir = ""
)
func DiffBuffer(file1 Buffer, file2 Buffer) ([]byte, error)
DiffBuffer will run a context diff between buf1 and buf2. file1 and file2 are file names for the buffer. Returns context diff. Saves buffers to disk and the runs a context iff on them, replacing the file names
func DiffFile(file1, file2 string) ([]byte, error)
DiffFile will run a context diff between file1 and file2 If an error is returned diff failed, error strings is returned if error is nil and no data is returned, then no differences
func DiffFileCommand(file1, file2, program, args string) ([]byte, error)
DiffFileCommand will run a context diff between file1 and file2 useing program and args If an error is returned diff failed, error strings is returned if error is nil and no data is returned, then no differences
type Buffer struct {
// Data to be diffed
Data []byte
// Filename is an option name of the to assocation with diff. If not specified, it will default to "file1" or "file2"
Filename string
// contains filtered or unexported fields
}
Buffer Defines a buffer to be diffed