GetUnifiedDiffString is like WriteUnifiedDiff but returns the diff a string.
(diff LineDiffParams)
| 901 | |
| 902 | // GetUnifiedDiffString is like WriteUnifiedDiff but returns the diff a string. |
| 903 | func GetUnifiedDiffString(diff LineDiffParams) (string, error) { |
| 904 | w := &bytes.Buffer{} |
| 905 | err := WriteUnifiedDiff(w, diff) |
| 906 | return w.String(), err |
| 907 | } |
| 908 | |
| 909 | // Convert range to the "ed" format. |
| 910 | func formatRangeContext(start, stop int) string { |