Radar · Go · Archive · Week 8 · Feb 16 – 22, 2026
cmd/vet: check for missing Err calls for bufio.Scanner and sql.Rows
Worth knowingtooling
- What changed
go vetnow warns whenbufio.Scanner.Err()orsql.Rows.Err()is not checked, except for known infallable readers.- Production impact
- The source does not say.
- Try it
- Write a small program that uses
bufio.Scannerwithout checkingErr()and rungo vet. - Source
- github.com/golang/go/issues/17747
Understand it, then run it
go vet now looks for places where you use a bufio.Scanner or sql.Rows and forget to call their Err() method. When you read from a scanner or iterate over rows, the Err() method tells you if an error happened during the operation. If you ignore that call, you might miss a failure and think the data was read correctly. The new check warns you when that call is missing, unless the underlying reader is known to never fail, such as a bytes.Buffer or strings.Reader.
Run it now
// This program demonstrates the new go vet check for missing Err calls
// on bufio.Scanner. It compiles and runs on Go 1.27.1. The program
// reads a string with a scanner, prints each token, and then checks
// scanner.Err() to ensure no scanning error occurred.
package main
import (
"bufio"
"fmt"
"strings"
)
func main() {
// Create a scanner over a simple string.
s := bufio.NewScanner(strings.NewReader("one two three"))
for s.Scan() { // use the scanner
fmt.Println(s.Text())
}
// Check the error after the loop.
if err := s.Err(); err != nil {
fmt.Println("scan error:", err)
}
}
What it printed when we ran it on Go 1.27.1
one two three
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed