Proposals Unofficial Go proposal tracker

Report %d formatting of pointers in the printf vet check

#62595 · go/analysis/passes/printf · low impact · Implemented ·

Formatting a pointer with %d prints its address as decimal digits. In practice this is almost always a bug: the author forgot to dereference a pointer to an integer. fmt accepts it and can't change, so the vet check will be stricter than fmt.

The printf vet check will now report any use of the %d verb with a pointer argument. To print the integer, dereference the pointer. If you really want the address in decimal, convert it to uintptr first.

n := new(int)
fmt.Printf("%d\n", n)                          // vet: %d with pointer
fmt.Printf("%d\n", *n)                         // OK: prints the value
fmt.Printf("%d\n", uintptr(unsafe.Pointer(n))) // OK: address in decimal
Proposal
#62595 by adonovan
Status
Implemented on Aug 26, 2026
Impact
low
Area
go/analysis/passes/printf