1
0
Fork 0

Fixes #16557 - duplicate csv import (#16631)

Remove the unnecessary duplicate package import for `encoding/csv` in `modules/csv/csv.go`

Fix #16557
This commit is contained in:
Richard Mahn 2021-08-05 10:56:11 -06:00 committed by GitHub
parent 3a1332c326
commit fd39e6dc6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,6 @@ package csv
import (
"bytes"
"encoding/csv"
stdcsv "encoding/csv"
"errors"
"io"
@ -97,9 +96,9 @@ func scoreDelimiter(lines []string, delim rune) float64 {
// FormatError converts csv errors into readable messages.
func FormatError(err error, locale translation.Locale) (string, error) {
var perr *csv.ParseError
var perr *stdcsv.ParseError
if errors.As(err, &perr) {
if perr.Err == csv.ErrFieldCount {
if perr.Err == stdcsv.ErrFieldCount {
return locale.Tr("repo.error.csv.invalid_field_count", perr.Line), nil
}
return locale.Tr("repo.error.csv.unexpected", perr.Line, perr.Column), nil