extra fields ok
This commit is contained in:
6
main.go
6
main.go
@@ -8,6 +8,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -23,9 +24,12 @@ func main() {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
if err != nil && !strings.Contains(err.Error(), "wrong number of fields") {
|
||||
panic(err)
|
||||
}
|
||||
for len(line) < len(fields) {
|
||||
line = append(line, "null")
|
||||
}
|
||||
if len(line) != len(fields) {
|
||||
log.Println("[WARN]", "line", n, "has", len(line), "fields but only", len(fields), "are known")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user