Skip to content

Commit

Permalink
enable reusing records in csv/tsv detection (#443)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gabriel-vasile committed Oct 12, 2023
1 parent b4da7ba commit e64d6bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/magic/text_csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Tsv(raw []byte, limit uint32) bool {
func sv(in []byte, comma rune, limit uint32) bool {
r := csv.NewReader(dropLastLine(in, limit))
r.Comma = comma
r.TrimLeadingSpace = true
r.ReuseRecord = true
r.LazyQuotes = true
r.Comment = '#'

Expand Down

0 comments on commit e64d6bd

Please sign in to comment.