GetContextDiffString is like WriteContextDiff but returns the diff as a string.
(diff LineDiffParams)
| 1031 | |
| 1032 | // GetContextDiffString is like WriteContextDiff but returns the diff as a string. |
| 1033 | func GetContextDiffString(diff LineDiffParams) (string, error) { |
| 1034 | w := &bytes.Buffer{} |
| 1035 | err := WriteContextDiff(w, diff) |
| 1036 | return w.String(), err |
| 1037 | } |
| 1038 | |
| 1039 | // SplitLines splits a string on "\n" while preserving them. The output can be used |
| 1040 | // as input for LineDiffParams. |