DoWithTimeout computes the (line oriented) modifications needed to turn the src string into the dst string. The `timeout` argument specifies the maximum amount of time it is allowed to spend in this function. If the timeout is exceeded, the parts of the strings which were not considered are turned i
(src, dst string, timeout time.Duration)
| 30 | // The underlying algorithm is Meyers, its complexity is O(N*d) where N is |
| 31 | // min(lines(src), lines(dst)) and d is the size of the diff. |
| 32 | func DoWithTimeout(src, dst string, timeout time.Duration) (diffs []diffmatchpatch.Diff) { |
| 33 | dmp := diffmatchpatch.New() |
| 34 | dmp.DiffTimeout = timeout |
| 35 | wSrc, wDst, warray := dmp.DiffLinesToRunes(src, dst) |
| 36 | diffs = dmp.DiffMainRunes(wSrc, wDst, false) |
| 37 | diffs = dmp.DiffCharsToLines(diffs, warray) |
| 38 | return diffs |
| 39 | } |
| 40 | |
| 41 | // Dst computes and returns the destination text. |
| 42 | func Dst(diffs []diffmatchpatch.Diff) string { |
no outgoing calls
no test coverage detected
searching dependent graphs…