Skip to content

Commit 5b9bb80

Browse files
committed
* simplifications (comments #150, #155)
1 parent 2fa6c8e commit 5b9bb80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

txtar/archive.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ func isMarker(data []byte) (name string, lineSeparator, after []byte) {
168168
// lineSeparator states if \n or \r\n should be appended as a line separator if it is not present.
169169
// Otherwise fixNL returns a new slice consisting of data with a final lineSeparator added.
170170
func fixNL(data , lineSeparator []byte) []byte {
171-
if len(data) == 0 || bytes.HasSuffix(data, lf) || bytes.HasSuffix(data, crlf) {
171+
if len(data) == 0 || bytes.HasSuffix(data, lf) {
172172
return data
173173
}
174174
d := make([]byte, len(data)+len(lineSeparator))
175175
copy(d, data)
176-
copy(d[len(d)-len(lineSeparator):], lineSeparator)
176+
copy(d[len(data):], lineSeparator)
177177
return d
178178
}

0 commit comments

Comments
 (0)