Skip to content

cmd/go: VCS stamping complains inappropriately about VCS in unreleated parent directory #49004

Closed
@rogpeppe

Description

@rogpeppe

commit 1cbec68

The Go compiler refuses to build my usual executables without specifying the -buildvcs=false flag.

Here's a testscript reproducer:

mkdir d/.bzr
cd d/m
exec git init
go build

-- d/m/go.mod --
module m

go 1.18

-- d/m/main.go --
package main

func main() {
}

This fails as follows:

% testscript /tmp/build-bug.txtar

> mkdir d/.bzr
> cd d/m
$WORK/d/m
> exec git init
[stdout]
Initialized empty Git repository in $WORK/d/m/.git/
> go build
[stderr]
error obtaining VCS status: directory "$WORK/d/m" uses git, but parent "$WORK/d" uses bzr
	Use -buildvcs=false to disable VCS stamping.

[exit status 1]
FAIL: /tmp/testscript742157310/build-bug.txtar/script.txt:4: unexpected go command failure
error running /tmp/build-bug.txtar in /tmp/testscript742157310/build-bug.txtar

When the nearest VCS directory is at the root of the current module, I believe it should be taken as definitive and the search should go no further back into parent directories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions