Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.7.3 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/matt"
GORACE=""
GOROOT="/home/matt/.gvm/gos/go1.7.3"
GOTOOLDIR="/home/matt/.gvm/gos/go1.7.3/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build698545690=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/zvrWRVgw4M
Used a bufio.Scanner
without checking bufio.Scanner.Err()
for error. The same mistake occurs frequently with sql.Rows.Err()
.
What did you expect to see?
go vet
should warn that s.Err()
was not called, and that it should be checked to determine if an error occurred while scanning.
This frequently occurs in our internal codebase at work. Arguably, go vet
could check if any type has a method Err() error
and report if the error is not checked or returned, instead of just checking the special cases with bufio.Scanner
and sql.Rows
. There may also be more types that use this pattern in the standard library.
What did you see instead?
No warnings from go vet
.
Metadata
Metadata
Assignees
Type
Projects
Status