(want, got string, context int)
| 11 | ) |
| 12 | |
| 13 | func Diff(want, got string, context int) (string, bool) { |
| 14 | records := difflib.Diff( |
| 15 | strings.Split(want, "\n"), |
| 16 | strings.Split(got, "\n"), |
| 17 | ) |
| 18 | |
| 19 | w := &bytes.Buffer{} |
| 20 | |
| 21 | changed := checkAndPrintRecords(w, records, context) |
| 22 | |
| 23 | return w.String(), changed |
| 24 | } |
| 25 | |
| 26 | func checkAndPrintRecords(w io.Writer, records []difflib.DiffRecord, context int) bool { |
| 27 | var changed bool |