diff

package
v1.14.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 4 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 {
	// contains filtered or unexported fields
}

func New

func New(a, b string) Diff

New creates a new Diff that might be queried further.

func (*Diff) GetConflictResolutionTemplate

func (d *Diff) GetConflictResolutionTemplate() string

GetConflictResolutionTemplate returns a single content with differences formatted in a manner similar to how merge conflicts are formatted by Git. Differences will be preceded by `<<<<<<< Deleted` followed by any lines present in `a` but not `b`, followed by `=======`, followed by any lines present in `b` but not `a`, followed by `>>>>>>> Added`. The lines in those blocks are not prefixed or otherwise altered. Any equal lines are included as is. Returns an empty string if there are no differences.

func (*Diff) GetUnifiedDiff

func (d *Diff) GetUnifiedDiff() string

GetUnifiedDiff returns the entire diff as a single string. Returns an empty string if there are no differences.

func (*Diff) GetUnifiedDiffConflictIndices

func (d *Diff) GetUnifiedDiffConflictIndices() []int

GetUnifiedDiffConflictIndices returns the indices of the lines of the diff returned by either GetUnifiedDiffLines or GetUnifiedDiff. Indices are zero-based. Returns nil if there were zero differences. Returns at least one index otherwise.

func (*Diff) GetUnifiedDiffLines

func (d *Diff) GetUnifiedDiffLines() []string

GetUnifiedDiffLines returns the lines of the diff. The lines are not terminated with \n. Returns nil if there were zero differences.

func (*Diff) IsDifferent

func (d *Diff) IsDifferent() bool

IsDifferent returns true if there were any differences between a and b.

Jump to

Keyboard shortcuts

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