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: git worktrees with gitdir ending in /.git no longer compile for some repos #58978

Closed
sharnoff opened this issue Mar 11, 2023 · 2 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@sharnoff
Copy link

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

$ go version
go version go1.20.2 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="/home/[redacted]/.cache/go-build"
GOENV="/home/[redacted]/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/[redacted]/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/[redacted]/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/[redacted]/temp/buildvcs-fail/main/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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4197836122=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Upgraded to the latest Go compiler.

This does not reproduce on all repos, but I noticed it while working on github.com/neondatabase/autoscaling. Replicating the error can be done with:

# enter a fresh, empty directory, then:
git clone --bare git@github.com:neondatabase/autoscaling .git
git worktree add main
cd main
go build ./... # fails!

(for posterity, the latest commit on the repo above is 0b082ec262, at time of writing)

Doing the above with any Go 1.19 compiler does not fail.

What did you expect to see?

After upgrading from 1.19 to 1.20, the repo should continue to compile with the git worktree structure as shown.

What did you see instead?

It did not compile, failing with:

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

I am aware that I can fix this problem by adding flags. However, it is a breaking change for a new version to require flags where it didn't before.

Please also note that this is not some sort of degenerate case of using git worktrees; this is the way that I typically structure my local files when working on multiple branches, and has specific unique advantages.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 11, 2023
@seankhliao seankhliao changed the title cmd/compile: git worktrees with gitdir ending in /.git no longer compile for some repos cmd/go: git worktrees with gitdir ending in /.git no longer compile for some repos Mar 11, 2023
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go and removed compiler/runtime Issues related to the Go compiler and/or runtime. labels Mar 11, 2023
@seankhliao
Copy link
Member

Duplicate of #58218

@seankhliao seankhliao marked this as a duplicate of #58218 Mar 11, 2023
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2023
@sharnoff
Copy link
Author

@seankhliao This is not a duplicate. #58218 was about VCS info not being included with worktrees (but still compiling). This issue is reporting that sometimes valid worktrees do not compile.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

3 participants