cmd/go: `go build` fails to read vcs info when .git is owned by a different user
#53 532 ouverte le 24 juin 2022
Métriques du dépôt
- Stars
- (133 883 étoiles)
- Métriques de merge PR
- (Métriques PR en attente)
Description
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
What did you do?
tried to build a program with a git repository in root, program stated:
$ sudo make
go build -o cpgov
error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
make: *** [Makefile:5: cpgov] Error 1
while running without root works
$ make
go build -o cpgov
$ sudo make install
# successfully installs now that compilation is not happening
example not using Makefile as image:

What did you expect to see?
The program should not fail to grab vcs info (seemingly) just because it is in root instead of the owning user of the git repository (swapping permissions on .git to 777 did not work, swapping owner of .git to root.root did not work).
What did you see instead?
go build outputted a very unhelpful error message that it failed to obtain VCS information for some reason, and left not enough information to even properly understand the scope of this issue, for that reason I do not fully understand the scope of this issue, or even if it is somehow intended behavior.