Skip to content

cmd/go: vcs info incorrect within git submodule #77196

Description

@EliRibble

Go version

go1.25.5

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/eliribble/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/eliribble/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/nix-shell.zbkHo7/go-build2213035054=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/eliribble/src/nidus-sync/db/bob/go.mod'
GOMODCACHE='/home/eliribble/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/eliribble/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nix/store/4wc5q32wgrhac7vb4da1zclhvw7r01wx-go-1.25.5/share/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/eliribble/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nix/store/4wc5q32wgrhac7vb4da1zclhvw7r01wx-go-1.25.5/share/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.5'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Create a git repository called 'parent'
Note the git status of the parent, specifically the commit ID and whether or not its 'dirty' (has uncommitted changes).
Create a git submodule inside parent called 'child'
Create a go module inside child
Note the git status of the child, specifically the commit ID and whether or not its 'dirty' (has uncommitted changes).
Compile the child module with 'go build'
Inspect built child program with 'go version -m child-binary'

What did you see happen?

Notice that vcs.revision and vcs.modified are taken from the git status of parent, not from the git status of child.

What did you expect to see?

I expected to see the vcs.revision and vcs.modified status of the child git repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions