This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Go · Archive · Week 46 · Nov 10 – 16, 2025

cmd/vet: add check for using %q with non‑{rune,byte} integer types

Worth knowingtooling

What changed
go vet now warns when the %q verb is used with an integer type that is not rune or byte.
Production impact
The source does not say.
Try it
Run go vet on a file that contains fmt.Printf("%q", 123) and observe the new warning.
Source
github.com/golang/go/issues/72850

Understand it, then run it

go vet now checks the %q verb in fmt.Printf. If you write fmt.Printf("%q", 123) the program prints the character whose Unicode code point is 123, which is {. The new check warns when the value you pass to %q is an integer that is not a rune or a byte. This helps you spot accidental misuse of %q that might lead to confusing output.

Run it now

Todaygo
// This program demonstrates the behavior that go vet now warns about: using
// the %q verb with an integer that is not a rune or byte.  The output shows
// that fmt.Printf("%q", 123) prints the character with code 123, which is
// '{'.
package main

import "fmt"

func main() {
	// Print the result of formatting an integer with %q.
	fmt.Printf("%q\n", 123)
}

What it printed when we ran it on Go 1.27.1

'{'

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