MCPcopy Create free account
hub / github.com/sergi/go-diff / pretty

Function pretty

diffmatchpatch/diff_test.go:25–46  ·  view source on GitHub ↗
(diffs []Diff)

Source from the content-addressed store, hash-verified

23)
24
25func pretty(diffs []Diff) string {
26 var w bytes.Buffer
27
28 for i, diff := range diffs {
29 _, _ = w.WriteString(fmt.Sprintf("%v. ", i))
30
31 switch diff.Type {
32 case DiffInsert:
33 _, _ = w.WriteString("DiffIns")
34 case DiffDelete:
35 _, _ = w.WriteString("DiffDel")
36 case DiffEqual:
37 _, _ = w.WriteString("DiffEql")
38 default:
39 _, _ = w.WriteString("Unknown")
40 }
41
42 _, _ = w.WriteString(fmt.Sprintf(": %v\n", diff.Text))
43 }
44
45 return w.String()
46}
47
48func diffRebuildTexts(diffs []Diff) []string {
49 texts := []string{"", ""}

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected