-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Milestone
Description
What version of Go are you using (go version
)?
$ go version go1.20.1 darwin/arm64
Does this issue reproduce with the latest release?
Yes it does
What operating system and processor architecture are you using (go env
)?
go env
Output
$ GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users//Library/Caches/go-build" GOENV="/Users//Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users//go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users//go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/opt/homebrew/Cellar/go/1.20.1/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/homebrew/Cellar/go/1.20.1/libexec/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.20.1" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users//go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/29/tcsmnyzs7px55jxt3grz88c80000gn/T/go-build3619271105=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I have read an invalid csv with csv.Reader
invalidCSV := "one,\"two\"\"" # extra quote which leads to parse error
csvReader := csv.NewReader(strings.NewReader(invalidCSV))
res, err := csvReader.Read()
See: https://go.dev/play/p/p66Sy_Z4494
What did you expect to see?
I have expected to receive a nil record and a non-nil error indicating the problem with this line of csv.
What did you see instead?
The method returns a partially parsed record and the appropriate error ErrQuote
.
The method's documentation states this should never happen:
Lines 188 to 191 in fc106b0
// If the record has an unexpected number of fields, | |
// Read returns the record along with the error ErrFieldCount. | |
// Except for that case, Read always returns either a non-nil | |
// record or a non-nil error, but not both. |
From what I can tell the behavior has changed 6 years ago with this change: 2181653
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted