From 5b9bb80a85e341458723fde89183552040f2a4c3 Mon Sep 17 00:00:00 2001 From: Jakub Skiba Date: Sat, 30 Sep 2023 16:40:31 +0200 Subject: [PATCH] * simplifications (comments #150, #155) --- txtar/archive.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/txtar/archive.go b/txtar/archive.go index 739ef809675..bc5b182985e 100644 --- a/txtar/archive.go +++ b/txtar/archive.go @@ -168,11 +168,11 @@ func isMarker(data []byte) (name string, lineSeparator, after []byte) { // lineSeparator states if \n or \r\n should be appended as a line separator if it is not present. // Otherwise fixNL returns a new slice consisting of data with a final lineSeparator added. func fixNL(data , lineSeparator []byte) []byte { - if len(data) == 0 || bytes.HasSuffix(data, lf) || bytes.HasSuffix(data, crlf) { + if len(data) == 0 || bytes.HasSuffix(data, lf) { return data } d := make([]byte, len(data)+len(lineSeparator)) copy(d, data) - copy(d[len(d)-len(lineSeparator):], lineSeparator) + copy(d[len(data):], lineSeparator) return d }