Skip to content

Commit e8554b8

Browse files
committed
Merge branch 'fix-formatting'
2 parents 017ffa6 + 7b7f521 commit e8554b8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

difflib/difflib.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,13 @@ func WriteContextDiff(writer io.Writer, diff ContextDiff) error {
679679
diffErr = err
680680
}
681681
}
682-
ws := func(s string) error {
682+
ws := func(s string) {
683683
_, err := buf.WriteString(s)
684-
return err
684+
if diffErr == nil && err != nil {
685+
diffErr = err
686+
}
685687
}
686-
688+
687689
if len(diff.Eol) == 0 {
688690
diff.Eol = "\n"
689691
}
@@ -713,7 +715,7 @@ func WriteContextDiff(writer io.Writer, diff ContextDiff) error {
713715
}
714716

715717
first, last := g[0], g[len(g)-1]
716-
wf("***************" + diff.Eol)
718+
ws("***************" + diff.Eol)
717719

718720
range1 := formatRangeContext(first.I1, last.I2)
719721
wf("*** %s ****%s", range1, diff.Eol)

0 commit comments

Comments
 (0)