Proposals Unofficial Go proposal tracker

Set vcs.modified only when changes affect the build

#77897 · cmd/go · medium impact · Accepted ·

Today the go command marks a binary as modified (vcs.modified=true in build info, plus a +dirty suffix on the main module version) whenever the repository has any uncommitted change. Even a stray x.prof file or the binary left behind by go build triggers it. This makes go install non-idempotent: running go build and then go install installs a +dirty binary and deletes ./foo, and the next go install installs a clean one.

With this change, the go command sets vcs.modified=true only if the build inputs differ from those of a build in a clean checkout at the same revision. A modified, added, or deleted file counts only if it is part of the current build or would be part of the same build from the clean checkout. The second case catches changes that remove a file from the build without breaking it. Examples are deleting a dead-code file, deleting a file with only init side effects, deleting an embedded file, or adding //go:build ignore.

The goal is no false negatives: a binary is never reported as clean when it differs from a clean build.

Proposal
#77897 by rsc
Status
Accepted on Jun 17, 2026
Impact
medium
Area
cmd/go