Skip to content

cmd/go: go build fails to read vcs info from isolated git submodule #53640

Closed
@MichaelVoelkel

Description

@MichaelVoelkel

What version of Go are you using (go version)?

1.18.3

Does this issue reproduce with the latest release?

Yes, with latest 1.18 (that is, 1.18.3), which is not the latest Go release itself, though

What operating system and processor architecture are you using (go env)?

It's a docker container but reproduces on Apple Silicon and on Debian 10 x86.

What did you do?

I just tried building my image:

docker build --no-cache -f deploy/Dockerfile .

and got output:

 > [3/4] RUN go build .:
#7 0.265 error obtaining VCS status: exit status 128
#7 0.265 	Use -buildvcs=false to disable VCS stamping.
------
executor failed running [/bin/sh -c go build .]: exit code: 1

What did you expect to see?

No error.

What did you see instead?

Failure.

So, to make this reproducible, I created a nested git repository because the error does not occur if I remove the nested/.git file. Recursively cloning the repo, cding into nested and then run aforementioned build command reproduces it for me on two systems:

https://github.com/MichaelVoelkel/vcs-test

I mean, sure, .git links to a folder that does not exist and just not copying everything into Docker would immediately help. But why does Go even care?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions