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

Method DiffMain

diffmatchpatch/diff.go:85–87  ·  view source on GitHub ↗

DiffMain finds the differences between two texts. The checklines flag is a speedup: if false, don't run a line-level diff first to identify the changed areas; if true, run a faster, slightly less optimal diff. If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacemen

(text1, text2 string, checklines bool)

Source from the content-addressed store, hash-verified

83// The checklines flag is a speedup: if false, don't run a line-level diff first to identify the changed areas; if true, run a faster, slightly less optimal diff.
84// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
85func (dmp *DiffMatchPatch) DiffMain(text1, text2 string, checklines bool) []Diff {
86 return dmp.DiffMainRunes([]rune(text1), []rune(text2), checklines)
87}
88
89// DiffMainRunes finds the differences between two rune sequences.
90// The checklines flag is a speedup: if false, don't run a line-level diff first to identify the changed areas; if true, run a faster, slightly less optimal diff.

Callers 15

PatchMakeMethod · 0.95
PatchApplyMethod · 0.95
TestPatchMakeInvalidUTF8Function · 0.80
TestDiffMainFunction · 0.80
TestDiffMainWithTimeoutFunction · 0.80
TestDiffPartialLineIndexFunction · 0.80
BenchmarkDiffMainFunction · 0.80
BenchmarkDiffMainLargeFunction · 0.80

Calls 1

DiffMainRunesMethod · 0.95

Tested by 15

TestPatchMakeInvalidUTF8Function · 0.64
TestDiffMainFunction · 0.64
TestDiffMainWithTimeoutFunction · 0.64
TestDiffPartialLineIndexFunction · 0.64
BenchmarkDiffMainFunction · 0.64
BenchmarkDiffMainLargeFunction · 0.64