1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// Copyright ©2021 The bíogo Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !go1.17
// +build !go1.17
package fai
import "encoding/csv"
// dropCSVColumn drops Column field information. It is required
// to harmonise behaviour between Go versions before and after
// v1.17. The relevant change in the standard library is 6d95e5a4.
func dropCSVColumn(err error) error {
csvErr, ok := err.(*csv.ParseError)
if !ok {
return err
}
if csvErr.Err == csv.ErrFieldCount {
csvErr.Column = 0
}
return csvErr
}
|