Skip to content

Commit 22283d2

Browse files
committed
* update comments
1 parent 74045de commit 22283d2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

txtar/archive.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ var (
105105
// findFileMarker finds the next file marker in data,
106106
// extracts the file name, and returns the data before the marker,
107107
// the file name, and the data after the marker.
108-
// useCRLF states if \n or \r\n should be treated as a line separator.
108+
// lineSep states if \n or \r\n should be appended by fixNL.
109109
// If there is no next marker, findFileMarker returns before = fixNL(data), name = "", after = nil.
110110
func findFileMarker(data, lineSep []byte) (before []byte, name string, lineSeparator []byte, after []byte) {
111111
var i int
@@ -122,9 +122,8 @@ func findFileMarker(data, lineSep []byte) (before []byte, name string, lineSepar
122122
}
123123

124124
// isMarker checks whether data begins with a file marker line.
125-
// If so, it returns the name from the line and the data after the line.
126-
// Otherwise it returns name == "" with an unspecified after.
127-
// useCRLF states if \n or \r\n should be treated as a line separator.
125+
// If so, it returns the name from the line, used line separator and the data after the line.
126+
// Otherwise it returns name == "" with unspecified lineSeparator and after.
128127
func isMarker(data []byte) (name string, lineSeparator, after []byte) {
129128
if !bytes.HasPrefix(data, marker) {
130129
return "", lineSeparator, nil
@@ -145,7 +144,7 @@ func isMarker(data []byte) (name string, lineSeparator, after []byte) {
145144
}
146145

147146
// If data is empty or ends in lineSeparator, fixNL returns data.
148-
// useCRLF states if \n or \r\n should be treated as a line separator.
147+
// lineSeparator states if \n or \r\n should be appended as a line separator if it is not present.
149148
// Otherwise fixNL returns a new slice consisting of data with a final lineSeparator added.
150149
func fixNL(data , lineSeparator []byte) []byte {
151150
if len(data) == 0 || bytes.HasSuffix(data, crlf) || bytes.HasSuffix(data, lf) {

0 commit comments

Comments
 (0)