SplitLines splits a []byte on "\n" while preserving them. The output can be used as input for UnifiedDiff and ContextDiff structures.
(s []byte)
| 1120 | // SplitLines splits a []byte on "\n" while preserving them. The output can be used |
| 1121 | // as input for UnifiedDiff and ContextDiff structures. |
| 1122 | func SplitLines(s []byte) [][]byte { |
| 1123 | lines := bytes.SplitAfter(s, []byte("\n")) |
| 1124 | lines[len(lines)-1] = append(lines[len(lines)-1], '\n') |
| 1125 | return lines |
| 1126 | } |
no outgoing calls