---
title: "Which commit was this Go binary built from, and was the tree clean? | Proofline"
description: "Run go version -m on the binary and read the vcs.revision, vcs.time and vcs.modified lines."
url: https://proofline.sh/learn/go-binary-vcs-revision-modified/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Which commit was this Go binary built from, and was the tree clean?

Run go version -m on the binary and read the vcs.revision, vcs.time and vcs.modified lines. A value of vcs.modified=false means the build tree matched that commit. A value of vcs.modified=true means it did not, and an untracked file is enough to set it. If the lines are missing, the build saw no repository or stamping was turned off, and the binary cannot tell you which commit it came from.

Deployment failures The Proofline team December 2, 2026 3 min read

## What the go command records

By default the go command stamps version control information "if the main package, the main module containing it, and the current directory are all in the same repository". `-buildvcs=false` always omits it. [Build flags](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies) The `runtime/debug` package defines `vcs.revision` as "the revision identifier for the current commit or checkout" and `vcs.modified` as "true or false indicating whether the source tree had local modifications". [BuildSetting](https://pkg.go.dev/runtime/debug#BuildSetting) `go version -m` prints these settings from the binary. [go version](https://pkg.go.dev/cmd/go#hdr-Print_Go_version)

## One commit, six builds

This fixture builds one commit six ways in the `golang:1.25` image (go1.25.14):

```
## 1. clean checkout
	build	vcs=git
	build	vcs.revision=724742f62fc9f47c913f9b59370f93226e11bbba
	build	vcs.time=2026-11-30T10:00:00Z
	build	vcs.modified=false
## 2. untracked file in the tree
	build	vcs=git
	build	vcs.revision=724742f62fc9f47c913f9b59370f93226e11bbba
	build	vcs.time=2026-11-30T10:00:00Z
	build	vcs.modified=true
## 3. edited tracked file, not committed
[…same four lines as build 2…]
## 4. -buildvcs=false
(no vcs lines)
## 5. source copied without .git
(no vcs lines)
## 6. .git owned by another user
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
exit 1
```

Builds 2 and 3 carry the same revision and the same `true`, although only build 3 compiled code that differs from the commit. Build 2's tree held a stray `notes.txt` that the compiler never read. The flag tells you that the tree differed, not how. A second run showed that a file listed in `.gitignore` leaves the flag `false`, and that `-ldflags` values appear on their own `build` line.

Builds 4 and 5 both succeed and both leave no trace. A CI step that copies sources into a build container without `.git`, or a Dockerfile `COPY` with `.git` excluded, produces build 5 silently.

Build 6 fails loudly. Git refuses a repository owned by another user, which happens when a container builds a checkout made by the runner's user. Adding `-buildvcs=false`, as the message suggests, turns it into build 4. Listing the directory in Git's `safe.directory` setting keeps the stamp. [safe.directory](https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory)

## Decide what the binary tells you

| `go version -m` shows | It establishes | Read next |
| --- | --- | --- |
| `vcs.modified=false` | The tracked source matched `vcs.revision`, and no untracked file outside `.gitignore` was present | The Go version on the first line and the `build -ldflags` line |
| `vcs.modified=true` | The tree differed from `vcs.revision` in some file | The build log, or `git status --porcelain` run in the build step |
| No `vcs` lines | Nothing about the commit | The build job's checkout and copy steps |

A clean stamp describes the main module's source. Dependencies appear on separate `dep` lines with their own versions, and nothing in the stamp shows that tests ran on this binary.

## Worked example

This example is fictional. Dara compares a production binary with the release tag. The revision matches, but `vcs.modified=true`. The release job's log shows a step that writes `version.txt` into the checkout before `go build`, and the file is not in `.gitignore`. She searches the code for a `//go:embed` that reads it, because an embedded file would put the difference into the binary, and finds none. Dara records the revision with that explanation and adds `version.txt` to `.gitignore`, so the next release stamps `false` and needs no explanation.

For the toolchain line, read [standard library vulnerabilities in Go binaries](/learn/go-binary-standard-library-vulnerability/). For cached test results, read [go test cached result](/learn/go-test-cached-result/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Is a standard library vulnerability in a Go binary fixed by rebuilding it?](/learn/go-binary-standard-library-vulnerability/)
    
    Security incidents The Proofline team November 25, 2026 5 min read
    
-   ### [Two builds of one commit have different checksums: is the source different?](/learn/reproducible-build-checksum-mismatch/)
    
    Deployment failures The Proofline team December 2, 2026 3 min read
