Skip to content

Commit e64d6bd

Browse files
enable reusing records in csv/tsv detection (#443)
This change should help with allocations, but ideally there would be no allocations when detecting csv. For that to happen the detection needs to move from using stdlib csv reader to something else.
1 parent b4da7ba commit e64d6bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/magic/text_csv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Tsv(raw []byte, limit uint32) bool {
2020
func sv(in []byte, comma rune, limit uint32) bool {
2121
r := csv.NewReader(dropLastLine(in, limit))
2222
r.Comma = comma
23-
r.TrimLeadingSpace = true
23+
r.ReuseRecord = true
2424
r.LazyQuotes = true
2525
r.Comment = '#'
2626

0 commit comments

Comments
 (0)