@@ -791,7 +791,7 @@ func formatRangeUnified(start, stop int) string {
791
791
}
792
792
793
793
// Unified diff parameters
794
- type UnifiedDiff struct {
794
+ type LineDiffParams struct {
795
795
A []string // First sequence lines
796
796
FromFile string // First file name
797
797
FromDate string // First file time
@@ -821,7 +821,7 @@ type UnifiedDiff struct {
821
821
// times. Any or all of these may be specified using strings for
822
822
// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
823
823
// The modification times are normally expressed in the ISO 8601 format.
824
- func WriteUnifiedDiff (writer io.Writer , diff UnifiedDiff ) error {
824
+ func WriteUnifiedDiff (writer io.Writer , diff LineDiffParams ) error {
825
825
//buf := bufio.NewWriter(writer)
826
826
//defer buf.Flush()
827
827
var bld strings.Builder
@@ -902,7 +902,7 @@ func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
902
902
}
903
903
904
904
// Like WriteUnifiedDiff but returns the diff a string.
905
- func GetUnifiedDiffString (diff UnifiedDiff ) (string , error ) {
905
+ func GetUnifiedDiffString (diff LineDiffParams ) (string , error ) {
906
906
w := & bytes.Buffer {}
907
907
err := WriteUnifiedDiff (w , diff )
908
908
return string (w .Bytes ()), err
@@ -922,7 +922,9 @@ func formatRangeContext(start, stop int) string {
922
922
return fmt .Sprintf ("%d,%d" , beginning , beginning + length - 1 )
923
923
}
924
924
925
- type ContextDiff UnifiedDiff
925
+ // For backward compatibility. Ugh.
926
+ type ContextDiff = LineDiffParams
927
+ type UnifiedDiff = LineDiffParams
926
928
927
929
// Compare two sequences of lines; generate the delta as a context diff.
928
930
//
@@ -1034,7 +1036,7 @@ func GetContextDiffString(diff ContextDiff) (string, error) {
1034
1036
}
1035
1037
1036
1038
// Split a string on "\n" while preserving them. The output can be used
1037
- // as input for UnifiedDiff and ContextDiff structures .
1039
+ // as input for LineDiffParams .
1038
1040
func SplitLines (s string ) []string {
1039
1041
lines := strings .SplitAfter (s , "\n " )
1040
1042
lines [len (lines )- 1 ] += "\n "
0 commit comments