To reproduce:
1) Have some bazel project with an external library provided by go_repository.
1) Build with bazel build -c dbg //program:main
1) Execute dlv exec bazel-bin/program/linux_amd64_debug/main
1) Set a breakpoint in the external library b github.com/abc/lib.(*Foo).Bar
1) Enter c to continue the execution until the breakpoint is hit
1) List the current source code with ls and see Command failed: open external/github.com/abc/lib/foo.go: no such file or directory
Is there any workaround besides not using bazel to build the debug binary?
It doesn't seem like we're stripping directory prefixes correctly at the moment. I think there are basically four cases here:
GOROOT, e.g., ./GOROOT/src/internal/cpu/cpu.go../external/com_github_pkg_errors/stack.goIs there any progress on this? This is pretty frustrating
I noticed the whole external/com_github_pkg_errors/stack.go source path formulation as we started building binaries in bazel and noticed that the stack traces differ now. Is that the intended source path for external go files over something like github.com/pkg/errors/stack.go?
Something that works for me:
bazel build -c dbg //program:maindlv exec bazel-bin/program/linux_amd64_debug/mainexternal/ path config substitute-path external/ /path/to/workspace-name/bazel-workspace-name/external/GOROOT/ path config substitute-path external/ /path/to/workspace-name/bazel-workspace-name/external/go_sdk/I put in an absolute path, but that's just out of convenience.
Most helpful comment
Is there any progress on this? This is pretty frustrating