Skip to content

Commit e0e2415

Browse files
committed
Supported long line of LTSV
If isPrefix is true, read again. Resolve #132
1 parent 8521d9e commit e0e2415

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

input_ltsv.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,19 @@ func (r *LTSVReader) read() (map[string]string, []string, error) {
116116
}
117117

118118
func (r *LTSVReader) readline() (string, error) {
119+
var buffer []byte
119120
for {
120-
line, _, err := r.reader.ReadLine()
121-
if err != nil {
122-
return "", err
121+
for {
122+
line, isPrefix, err := r.reader.ReadLine()
123+
if err != nil {
124+
return "", err
125+
}
126+
buffer = append(buffer, line...)
127+
if !isPrefix {
128+
break
129+
}
123130
}
124-
str := strings.TrimSpace(string(line))
131+
str := strings.TrimSpace(string(buffer))
125132
if len(str) != 0 {
126133
return str, nil
127134
}

0 commit comments

Comments
 (0)