Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go/internal/load: better error message for "error obtaining VCS status" #64275

Closed
jingyuanliang opened this issue Nov 20, 2023 · 3 comments
Closed
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jingyuanliang
Copy link

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

$ go version
go version go1.22-20230908-RC04 cl/563875016 +2fe2f08542 X:fieldtrack,boringcrypto linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/jingyuanliang/.cache/go-build'
GOENV='/usr/local/google/home/jingyuanliang/.config/go/env'
GOEXE=''
GOEXPERIMENT='fieldtrack,boringcrypto'
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr/local/google/home/jingyuanliang/go/pkg/mod'
GONOPROXY='*.googlesource.com,*.git.corp.google.com'
GONOSUMDB='*.googlesource.com,*.git.corp.google.com'
GOOS='linux'
GOPATH='/usr/local/google/home/jingyuanliang/go'
GOPRIVATE='*.googlesource.com,*.git.corp.google.com'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/google-golang'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/google-golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22-20230908-RC04 cl/563875016 +2fe2f08542 X:fieldtrack,boringcrypto'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/usr/local/google/home/jingyuanliang/go128/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1980328498=/tmp/go-build -gno-record-gcc-switches'

What did you do?

[hi on] jingyuanliang@jingyuanliang:~$ mkdir go128
[hi on] jingyuanliang@jingyuanliang:~$ cd go128
[hi on] jingyuanliang@jingyuanliang:~/go128$ git init
Initialized empty Git repository in /usr/local/google/home/jingyuanliang/go128/.git/
[hi on] jingyuanliang@jingyuanliang:~/go128:main$ go mod init go128
go: creating new go.mod: module go128
[hi on] jingyuanliang@jingyuanliang:~/go128:main$ sudo chown -R root:root .
[sudo] password for jingyuanliang: 
[hi on] jingyuanliang@jingyuanliang:~/go128$ sudo chmod -R 777 .
Skippy Security Tip: Setting global read/write/execute permissions will give all users on this machine full access to these files/programs and may provide access they shouldn't otherwise have.
Suggestion: 
More info: 
Do you still want to execute this command? [y/n]y
[hi on] jingyuanliang@jingyuanliang:~/go128$ cat>main.go
package main
func main(){}
[hi on] jingyuanliang@jingyuanliang:~/go128$ go build
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
[hi on] jingyuanliang@jingyuanliang:~/go128$ 

What did you expect to see?

A clear error message, by relaying git's error message (fatal: detected dubious ownership..., probably by letting it inherit stderr stream fd=2) to user for better visibility.

Or at least it should say it's git failing, preferably print the command line used to invoke git, so users can reproduce it themselves.

What did you see instead?

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
@rusu30
Copy link

rusu30 commented Nov 20, 2023

It looks like you are encountering an issue with Git while trying to build your Go project. The error message indicates that there's a problem obtaining the VCS (Version Control System) status, and it provides a suggestion to use -buildvcs=false to disable VCS stamping.

The most likely cause of this issue is related to the ownership and permissions you set on your project directory. You changed the ownership to root and granted read/write/execute permissions to everyone, which might have caused problems when Go is interacting with Git.

@mknyszek mknyszek added the GoCommand cmd/go label Nov 20, 2023
@mknyszek mknyszek added this to the Backlog milestone Nov 20, 2023
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 20, 2023
@mknyszek
Copy link
Contributor

mknyszek commented Nov 20, 2023

@bcmills
Copy link
Contributor

bcmills commented Nov 20, 2023

Duplicate of #53532

@bcmills bcmills marked this as a duplicate of #53532 Nov 20, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants