Archive · Week 31 · Jul 27 – Aug 2, 2026from 2 items
The Go team accepted two proposals that touch the standard library and the vet tool. One adds ACME profile support to the crypto/acme package, the other tightens the printf vet check to reject formatting pointers with %d.
Worth knowingtooling
go/analysis/passes/printf: disallow %d formatting of pointers
- What changed
- The vet checker now reports an error when a pointer value is formatted with the
%dverb. - Production impact
- The source does not say.
- Try it
- Run
go vet ./...on a package that containsfmt.Sprintf("%d", ptr)whereptris a pointer; you should see a vet error. - Source
- github.com/golang/go/issues/62595
Explain it and run it
Understand it, then run it
The Go vet tool checks code for common mistakes. One check looks at calls to fmt.Printf‑style functions. It used to allow formatting a pointer with the %d verb, which prints a decimal number. That number is actually the pointer’s address, but most people expect %d to print an integer value. The change makes vet report an error when a pointer is passed to %d.
Now, if you write fmt.Printf("%d", &x) where x is an int, vet will warn you that this is likely a mistake. You should either dereference the pointer (*p) or use a different verb.
The change does not alter how fmt itself works; it only adds a stricter check in the static analysis.
Run it now
// This program demonstrates the new vet rule: it will fail vet
// if you try to format a pointer with %d. The code compiles
// and runs, but running `go vet` on it will produce an error.
package main
import "fmt"
func main() {
x := 42
p := &x
// The following line would trigger the new vet error:
// fmt.Printf("%d\n", p)
// Instead we dereference the pointer to print the value.
fmt.Printf("%d\n", *p)
}
What it printed when we ran it on Go 1.27.1
42
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.
Exercise
Exercise – Spot the “%d” pointer misuse
Write a small program that formats a pointer value with the %d verb. Then change the program so that it no longer triggers the new vet error (i.e., format the integer value instead of the pointer).
The goal is to see how the updated printf vet check catches this mistake and how to fix it.
package main
import (
"fmt"
)
func main() {
p := new(int)
*p = 42
// The following line will be flagged by the updated vet checker
s := fmt.Sprintf("%d", p)
fmt.Println(s)
}
Show a solution
package main
import (
"fmt"
)
func main() {
p := new(int)
*p = 42
// Dereference the pointer to format the integer value
s := fmt.Sprintf("%d", *p)
fmt.Println(s)
}
What it printed when we ran it on Go 1.27.1
42
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.
The 60-second version
This week the Go team added support for ACME profiles in the crypto/acme package, letting you request a specific issuance profile when creating an order. They also tightened the vet tool to flag any attempt to format a pointer with the %d verb, catching a common mistake. Both changes are worth noting for anyone working with ACME or relying on vet for code quality.
Written by gpt-oss-20b · claims checked against the sources · archive, not individually reviewed