-
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: stacktraces with -trimpath don't use replaced module paths #68493
Comments
I don't think the code you provided reproduces the issue. That said, replace changes just the code for a module, not the identity. The names used are still all before the replace is applied, and even the replacing module will claim its identity is the original one. A module name does not strictly correlate to where the source code was obtained from, it is only by convention/convenience that it most of the time they are the same. |
@seankhliao My apologies, apparently there was a commit waiting to be pushed to my reproducer branch. Please try it again. Here's what I see:
The path is what I expect if I do not use |
@seankhliao Could you take a look at the above output? |
Go version
go version go1.22.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I built a Go program using a replace directive for
gioui.org
to point at a fork.What did you see happen?
When that program crashes due to a panic in the replaced dependency, the stacktrace uses the un-replaced module version in the stacktrace:
When I run
go version -m hello.out
, I see:What did you expect to see?
I expect the stacktrace to show
git.sr.ht/~whereswaldon/gio@v0.0.0-20240717140507-395bbbc24e41
as the module name of the code that generated the panic.More generally, I expect the stacktrace to always refer to the code actually included in the executable, and not just the version in the
require
directive ingo.mod
.I know I used
-trimpath
when building. This issue does not exist without-trimpath
. However, the executable still contains the info needed to show the correct module.If the
replace
were to a local filesystem path instead of a different repo, I know-trimpath
might discard the info necessary to print a perfectly accurate path, but could that be displayed as[path trimmed]/file.go
?I know that this is likely a complex problem, and maybe my expectations are simply unreasonable. Please educate me if that is the case. 😄 Thanks!
The text was updated successfully, but these errors were encountered: