-
Notifications
You must be signed in to change notification settings - Fork 797
Add explicit documentation for configuring substitutePaths when using -trimpath #2609
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
Comments
Today I observed another google user who wanted to debug a binary built with compiler's
Ideally, it would be nice if this |
Change https://go.dev/cl/469916 mentions this issue: |
@hyangah @suzmue Capitalization is another potential pitfall. The project I am working on has a dependency with a capitalized name in the path. With |
Updates #2609 Change-Id: I6fae938b428f834f8e55e2e8afd4d309db33d0a9 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/469916 Reviewed-by: Ethan Reesor <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]>
[Update: The day after posting this comment, I saw fa820d4, which already covers everything I found. My comment is mostly redundant. Sorry!] I've been investigating remotely debugging Go executables distributed in container images. I used https://github.com/kubernetes/sample-controller as an example. I built it with go 1.20.1 and found the following:
Based on this, I defined one substitution for my target module, one substitution for every module in the standard library, and one for the Go mod cache. Working set of substitutions"substitutePath": [ // Our module, built with -trimpath { "from": "/home/myuser/sample-controller", "to": "k8s.io/sample-controller", }, // Packages in GOROOT (standard library) { "from": "/home/myuser/.local/go/1.20.1/src/archive", "to": "archive" }, { "from": "/home/myuser/.local/go/1.20.1/src/arena", "to": "arena" }, { "from": "/home/myuser/.local/go/1.20.1/src/bufio", "to": "bufio" }, { "from": "/home/myuser/.local/go/1.20.1/src/builtin", "to": "builtin" }, { "from": "/home/myuser/.local/go/1.20.1/src/bytes", "to": "bytes" }, { "from": "/home/myuser/.local/go/1.20.1/src/cmd", "to": "cmd" }, { "from": "/home/myuser/.local/go/1.20.1/src/compress", "to": "compress" }, { "from": "/home/myuser/.local/go/1.20.1/src/container", "to": "container" }, { "from": "/home/myuser/.local/go/1.20.1/src/context", "to": "context" }, { "from": "/home/myuser/.local/go/1.20.1/src/crypto", "to": "crypto" }, { "from": "/home/myuser/.local/go/1.20.1/src/database", "to": "database" }, { "from": "/home/myuser/.local/go/1.20.1/src/debug", "to": "debug" }, { "from": "/home/myuser/.local/go/1.20.1/src/embed", "to": "embed" }, { "from": "/home/myuser/.local/go/1.20.1/src/encoding", "to": "encoding" }, { "from": "/home/myuser/.local/go/1.20.1/src/errors", "to": "errors" }, { "from": "/home/myuser/.local/go/1.20.1/src/expvar", "to": "expvar" }, { "from": "/home/myuser/.local/go/1.20.1/src/flag", "to": "flag" }, { "from": "/home/myuser/.local/go/1.20.1/src/fmt", "to": "fmt" }, { "from": "/home/myuser/.local/go/1.20.1/src/go", "to": "go" }, { "from": "/home/myuser/.local/go/1.20.1/src/hash", "to": "hash" }, { "from": "/home/myuser/.local/go/1.20.1/src/html", "to": "html" }, { "from": "/home/myuser/.local/go/1.20.1/src/image", "to": "image" }, { "from": "/home/myuser/.local/go/1.20.1/src/index", "to": "index" }, { "from": "/home/myuser/.local/go/1.20.1/src/internal", "to": "internal" }, { "from": "/home/myuser/.local/go/1.20.1/src/io", "to": "io" }, { "from": "/home/myuser/.local/go/1.20.1/src/log", "to": "log" }, { "from": "/home/myuser/.local/go/1.20.1/src/math", "to": "math" }, { "from": "/home/myuser/.local/go/1.20.1/src/mime", "to": "mime" }, { "from": "/home/myuser/.local/go/1.20.1/src/net", "to": "net" }, { "from": "/home/myuser/.local/go/1.20.1/src/os", "to": "os" }, { "from": "/home/myuser/.local/go/1.20.1/src/path", "to": "path" }, { "from": "/home/myuser/.local/go/1.20.1/src/plugin", "to": "plugin" }, { "from": "/home/myuser/.local/go/1.20.1/src/reflect", "to": "reflect" }, { "from": "/home/myuser/.local/go/1.20.1/src/regexp", "to": "regexp" }, { "from": "/home/myuser/.local/go/1.20.1/src/runtime", "to": "runtime" }, { "from": "/home/myuser/.local/go/1.20.1/src/sort", "to": "sort" }, { "from": "/home/myuser/.local/go/1.20.1/src/strconv", "to": "strconv" }, { "from": "/home/myuser/.local/go/1.20.1/src/strings", "to": "strings" }, { "from": "/home/myuser/.local/go/1.20.1/src/sync", "to": "sync" }, { "from": "/home/myuser/.local/go/1.20.1/src/syscall", "to": "syscall" }, { "from": "/home/myuser/.local/go/1.20.1/src/testdata", "to": "testdata" }, { "from": "/home/myuser/.local/go/1.20.1/src/testing", "to": "testing" }, { "from": "/home/myuser/.local/go/1.20.1/src/text", "to": "text" }, { "from": "/home/myuser/.local/go/1.20.1/src/time", "to": "time" }, { "from": "/home/myuser/.local/go/1.20.1/src/unicode", "to": "unicode" }, { "from": "/home/myuser/.local/go/1.20.1/src/unsafe", "to": "unsafe" }, { "from": "/home/myuser/.local/go/1.20.1/src/vendor", "to": "vendor" }, // Modules in GOMODCACHE { "from": "/home/myuser/.local/go/pkg/mod", "to": "", }, ] Some observations
|
Is your feature request related to a problem? Please describe.
It is not clear how to set up
substitutePaths
when debugging a binary built with-trimpath
.Describe the solution you'd like
A section in docs/debugging.md that shows an example of how to debug a binary built with
-trimpath
.Describe alternatives you've considered
Stumbling around and googling until you find go-delve/delve#2754, then figuring it out on your own from there.
The text was updated successfully, but these errors were encountered: