mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00
fix: dep ensure. now without gofmt on ventor directory
This commit is contained in:
26
vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
generated
vendored
26
vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
generated
vendored
@ -85,7 +85,7 @@ func (dmp *DiffMatchPatch) diffMainRunes(text1, text2 []rune, checklines bool, d
|
||||
|
||||
// Restore the prefix and suffix.
|
||||
if len(commonprefix) != 0 {
|
||||
diffs = append([]Diff{{DiffEqual, string(commonprefix)}}, diffs...)
|
||||
diffs = append([]Diff{Diff{DiffEqual, string(commonprefix)}}, diffs...)
|
||||
}
|
||||
if len(commonsuffix) != 0 {
|
||||
diffs = append(diffs, Diff{DiffEqual, string(commonsuffix)})
|
||||
@ -122,16 +122,16 @@ func (dmp *DiffMatchPatch) diffCompute(text1, text2 []rune, checklines bool, dea
|
||||
}
|
||||
// Shorter text is inside the longer text (speedup).
|
||||
return []Diff{
|
||||
{op, string(longtext[:i])},
|
||||
{DiffEqual, string(shorttext)},
|
||||
{op, string(longtext[i+len(shorttext):])},
|
||||
Diff{op, string(longtext[:i])},
|
||||
Diff{DiffEqual, string(shorttext)},
|
||||
Diff{op, string(longtext[i+len(shorttext):])},
|
||||
}
|
||||
} else if len(shorttext) == 1 {
|
||||
// Single character string.
|
||||
// After the previous speedup, the character can't be an equality.
|
||||
return []Diff{
|
||||
{DiffDelete, string(text1)},
|
||||
{DiffInsert, string(text2)},
|
||||
Diff{DiffDelete, string(text1)},
|
||||
Diff{DiffInsert, string(text2)},
|
||||
}
|
||||
// Check to see if the problem can be split in two.
|
||||
} else if hm := dmp.diffHalfMatch(text1, text2); hm != nil {
|
||||
@ -145,7 +145,7 @@ func (dmp *DiffMatchPatch) diffCompute(text1, text2 []rune, checklines bool, dea
|
||||
diffsA := dmp.diffMainRunes(text1A, text2A, checklines, deadline)
|
||||
diffsB := dmp.diffMainRunes(text1B, text2B, checklines, deadline)
|
||||
// Merge the results.
|
||||
return append(diffsA, append([]Diff{{DiffEqual, string(midCommon)}}, diffsB...)...)
|
||||
return append(diffsA, append([]Diff{Diff{DiffEqual, string(midCommon)}}, diffsB...)...)
|
||||
} else if checklines && len(text1) > 100 && len(text2) > 100 {
|
||||
return dmp.diffLineMode(text1, text2, deadline)
|
||||
}
|
||||
@ -330,8 +330,8 @@ func (dmp *DiffMatchPatch) diffBisect(runes1, runes2 []rune, deadline time.Time)
|
||||
}
|
||||
// Diff took too long and hit the deadline or number of diffs equals number of characters, no commonality at all.
|
||||
return []Diff{
|
||||
{DiffDelete, string(runes1)},
|
||||
{DiffInsert, string(runes2)},
|
||||
Diff{DiffDelete, string(runes1)},
|
||||
Diff{DiffInsert, string(runes2)},
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
|
||||
insPoint := equalities.data
|
||||
diffs = append(
|
||||
diffs[:insPoint],
|
||||
append([]Diff{{DiffDelete, lastequality}}, diffs[insPoint:]...)...)
|
||||
append([]Diff{Diff{DiffDelete, lastequality}}, diffs[insPoint:]...)...)
|
||||
|
||||
// Change second copy to insert.
|
||||
diffs[insPoint+1].Type = DiffInsert
|
||||
@ -726,7 +726,7 @@ func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
|
||||
// Overlap found. Insert an equality and trim the surrounding edits.
|
||||
diffs = append(
|
||||
diffs[:pointer],
|
||||
append([]Diff{{DiffEqual, insertion[:overlapLength1]}}, diffs[pointer:]...)...)
|
||||
append([]Diff{Diff{DiffEqual, insertion[:overlapLength1]}}, diffs[pointer:]...)...)
|
||||
|
||||
diffs[pointer-1].Text =
|
||||
deletion[0 : len(deletion)-overlapLength1]
|
||||
@ -955,7 +955,7 @@ func (dmp *DiffMatchPatch) DiffCleanupEfficiency(diffs []Diff) []Diff {
|
||||
|
||||
// Duplicate record.
|
||||
diffs = append(diffs[:insPoint],
|
||||
append([]Diff{{DiffDelete, lastequality}}, diffs[insPoint:]...)...)
|
||||
append([]Diff{Diff{DiffDelete, lastequality}}, diffs[insPoint:]...)...)
|
||||
|
||||
// Change second copy to insert.
|
||||
diffs[insPoint+1].Type = DiffInsert
|
||||
@ -1028,7 +1028,7 @@ func (dmp *DiffMatchPatch) DiffCleanupMerge(diffs []Diff) []Diff {
|
||||
if x > 0 && diffs[x-1].Type == DiffEqual {
|
||||
diffs[x-1].Text += string(textInsert[:commonlength])
|
||||
} else {
|
||||
diffs = append([]Diff{{DiffEqual, string(textInsert[:commonlength])}}, diffs...)
|
||||
diffs = append([]Diff{Diff{DiffEqual, string(textInsert[:commonlength])}}, diffs...)
|
||||
pointer++
|
||||
}
|
||||
textInsert = textInsert[commonlength:]
|
||||
|
4
vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
generated
vendored
4
vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
generated
vendored
@ -93,7 +93,7 @@ func (dmp *DiffMatchPatch) PatchAddContext(patch Patch, text string) Patch {
|
||||
// Add the prefix.
|
||||
prefix := text[max(0, patch.Start2-padding):patch.Start2]
|
||||
if len(prefix) != 0 {
|
||||
patch.diffs = append([]Diff{{DiffEqual, prefix}}, patch.diffs...)
|
||||
patch.diffs = append([]Diff{Diff{DiffEqual, prefix}}, patch.diffs...)
|
||||
}
|
||||
// Add the suffix.
|
||||
suffix := text[patch.Start2+patch.Length1 : min(len(text), patch.Start2+patch.Length1+padding)]
|
||||
@ -336,7 +336,7 @@ func (dmp *DiffMatchPatch) PatchAddPadding(patches []Patch) string {
|
||||
// Add some padding on start of first diff.
|
||||
if len(patches[0].diffs) == 0 || patches[0].diffs[0].Type != DiffEqual {
|
||||
// Add nullPadding equality.
|
||||
patches[0].diffs = append([]Diff{{DiffEqual, nullPadding}}, patches[0].diffs...)
|
||||
patches[0].diffs = append([]Diff{Diff{DiffEqual, nullPadding}}, patches[0].diffs...)
|
||||
patches[0].Start1 -= paddingLength // Should be 0.
|
||||
patches[0].Start2 -= paddingLength // Should be 0.
|
||||
patches[0].Length1 += paddingLength
|
||||
|
Reference in New Issue
Block a user