Skip to content

Commit

Permalink
[csv] Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed May 4, 2024
1 parent 41feac2 commit fdf5208
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func parseAndFill(src string, dst Row, sep string) {
l := len(dst)

if src == "" {
clean(dst, 0, l)
clean(dst, 0)
return
}

Expand All @@ -245,7 +245,7 @@ func parseAndFill(src string, dst Row, sep string) {

if n == 0 {
dst[0] = src
clean(dst, 1, l)
clean(dst, 1)
return
}

Expand All @@ -263,13 +263,13 @@ func parseAndFill(src string, dst Row, sep string) {
}

if i < l-1 {
clean(dst, i+1, l)
clean(dst, i+1)
}
}

// clean cleans destination slice
func clean(dst Row, since, to int) {
for i := since; i < to; i++ {
func clean(dst Row, from int) {
for i := from; i < len(dst); i++ {
dst[i] = ""
}
}

0 comments on commit fdf5208

Please sign in to comment.