Skip to content

debspencer/diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diff - wrapper for diff

Package diff provides a wrapper around the diff program.

import "github.com/debspencer/diff"

diff.go

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

About

Golang wrapper for diff program output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published