-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: binary does not contain VCS information when compiled in git worktree dir #58218
Comments
Does this reproduce with earlier releases? |
It does; I have a fix ready. It's a rather simple one, we were just assuming that |
Change https://go.dev/cl/463849 mentions this issue: |
As mentioned in #58978 and #59068, this issue also affects work trees inside bare Git repositories where running
|
Change https://go.dev/cl/480635 mentions this issue: |
In `git worktree` checkouts, rather than a .git directory, .git is a file containing the path of the real repository. Presence of this file will confuse git invoked by the go tool, so don't push it, just as we don't push a .git directory. For golang/go#58218. Change-Id: I2d316d5672a87ba9cb7175a07e06e99a3392a85d Reviewed-on: https://go-review.googlesource.com/c/build/+/480635 Reviewed-by: Carlos Amedee <[email protected]> Run-TryBot: Michael Pratt <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Michael Pratt <[email protected]>
Noticed while working on #371, but it appears that golangci-lint will sometimes hide errors that it *should* be showing if compiling succeeds. So if, hypothetically, you're impacted by golang/go#58218 and normally you're able to get by with 'go build -buildvcs=false ./...' but golangci-lint doesn't have that functionality, then this is able to reproduce on main.
Thanks for the start of the patch process @mvdan. I looked at the thread there, and I'm not sure what the remaining work is. Is the ask for a revert of the original logic change that broke worktrees with a regression test? |
@cehoffman, hi, I don’t think there is any work to do here aside from getting CL 463849 rebased, reviewed and merged, ideally also backported to stable release. I’ve also added comments with regression test suggestions for my particular use case (i.e. bare Git repository with work trees), but that shouldn’t be that different from the regression test already present in the CL. I’ve been using Go toolchain with |
The discussion in https://go.dev/cl/463849 seems to be stalled. Does anyone know what's the state of this? |
@mvdan Do you have context on this? Did you send out a fix with regression test? |
I didn't do anything beyond https://go-review.googlesource.com/c/go/+/463849; writing the git worktree test and doing the revert is somewhere on my TODO list. I honestly don't use git worktrees at the moment so it's not my top priority. I'm happy for someone else to do this and I'll close my CL. |
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
)?go env
OutputWhat did you do?
Run
testscript
on the following file:What did you expect to see?
A successful test.
What did you see instead?
The binary built in a git worktree directory does not contain VCS information.
I suspect the logic doesn't understand that
.git
can be a file was well as a directory.The text was updated successfully, but these errors were encountered: