Skip to content

x/tools/go/analysis/passes/printf, cmd/vet: gate non-constant format string check on 1.24 language version #71485

Closed
@findleyr

Description

@findleyr

The new check added to the printf analyzer in #60529 reports errors for non-constant format strings. In almost all cases we've investigated, these turn out to be bugs.

However, they are mild bugs, and the analyzer can produce quite a large number of findings.
We experienced this in our own codebase when the analyzer landed, and the community is experiencing a similar amount of churn:
https://lwn.net/ml/fedora-devel/CAM4%3DqPKbUw4DoLkdXtk4XJM718bm8soGuHE%2BL58Lq5UJ%3DBZBwg%40mail.gmail.com/

To reduce the friction caused by this change, we should gate the new check on a 1.24 language version, so as to not break the tests of existing codebases. Users can address the new vet errors incrementally as they update the language versions of their modules.

(@rsc and @adonovan suggest doing this as a matter of principle when we add new vet checks, but that is a policy question outside the scope of this issue)

Marking this as a release blocker, to guard the RC.

Activity

added this to the Go1.24 milestone on Jan 30, 2025
self-assigned this
on Jan 30, 2025
added
ToolsThis label describes issues relating to any tools in the x/tools repository.
on Jan 30, 2025
added
ToolProposalIssues describing a requested change to a Go tool or command-line program.
on Jan 30, 2025
gopherbot

gopherbot commented on Jan 30, 2025

@gopherbot
Contributor

Change https://go.dev/cl/645595 mentions this issue: go/analysis/passes/printf: suppress errors for non-const format strings

gopherbot

gopherbot commented on Jan 30, 2025

@gopherbot
Contributor

Change https://go.dev/cl/645615 mentions this issue: cmd: update golang.org/x/tools to 9f450b0, and revendor

gopherbot

gopherbot commented on Jan 30, 2025

@gopherbot
Contributor

Change https://go.dev/cl/645697 mentions this issue: [internal-branch.go1.24-vendor] go/analysis/passes/printf: suppress errors for non-const format strings

gopherbot

gopherbot commented on Jan 31, 2025

@gopherbot
Contributor

Change https://go.dev/cl/645336 mentions this issue: cmd: update golang.org/x/tools to CL 645697, and revendor

3 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ToolProposalIssues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.release-blocker

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @gopherbot@findleyr@gabyhelp

      Issue actions

        x/tools/go/analysis/passes/printf, cmd/vet: gate non-constant format string check on 1.24 language version · Issue #71485 · golang/go