-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
extract keys from a map #3164
Comments
Printing the map ( |
You can write a starlark script and load it into Delve which can perform this task for you: def command_iterate_kv(m):
c = eval(None, m).Variable.Children
window_size = 2
for i in range(len(c) - window_size + 1):
print("key=", c[i].Value)
print("value=", c[i+1].Value) Name the file |
For more information on our starlark scripting interface see: https://github.com/go-delve/delve/blob/master/Documentation/cli/starlark.md. |
Indeed it will, but it won't allow me access/inspect this value. In the specific case of my example, I'm dealing with an interface backed by a struct with many deeply nested data fields, only a few of which I actually want to see. I would love to be able to select fields of this value.
Thanks, this looks like it could be a good workaround and I will try it out. That said, I do posit that this would be a nice thing to have "natively":
Of course, the ordering of the keys could be a problem, at the very least it should be deterministic. |
I've adjusted the example above a little bit. It didn't work as-is when I first tried it because if you don't name the argument to the new command
|
dlv version
)? 1.9.1go version
)? 1.19Imagine a map from interface to bool:
I find myself in a situation where I really want to inspect the key (stored as an interface), but I can't find how to actually get at (name) this key in Delve. I've tried things like:
Pingback to #1465, whose problem can (I think) be worked around if something like this were available.
The text was updated successfully, but these errors were encountered: