MCPcopy Create free account
hub / github.com/sergi/go-diff / DiffText1

Method DiffText1

diffmatchpatch/diff.go:1197–1207  ·  view source on GitHub ↗

DiffText1 computes and returns the source text (all equalities and deletions).

(diffs []Diff)

Source from the content-addressed store, hash-verified

1195
1196// DiffText1 computes and returns the source text (all equalities and deletions).
1197func (dmp *DiffMatchPatch) DiffText1(diffs []Diff) string {
1198 //StringBuilder text = new StringBuilder()
1199 var text bytes.Buffer
1200
1201 for _, aDiff := range diffs {
1202 if aDiff.Type != DiffInsert {
1203 _, _ = text.WriteString(aDiff.Text)
1204 }
1205 }
1206 return text.String()
1207}
1208
1209// DiffText2 computes and returns the destination text (all equalities and insertions).
1210func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {

Callers 7

PatchMakeMethod · 0.95
patchMake2Method · 0.95
PatchApplyMethod · 0.95
TestDiffTextFunction · 0.80
TestDiffDeltaFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 4

TestDiffTextFunction · 0.64
TestDiffDeltaFunction · 0.64