delve
delve copied to clipboard
To report variable declaration column
It would be nice if delve reported DeclColumn
in addition to DeclLine
for variables. This would allow a front-end to sort variables in a declaration order and handle multi-variable declarations as well as function arguments/named returns.
debug_info doesn't have that and IMHO adding it wouldn't be worth the binary size inflation. Function arguments are already returned sorted in their declaration order (at least in 1.12, there was a bug in either 1.10 or 1.11, don't remember).
Do I understand correctly that multiple declarations on the line are also returned by delve in declaration order? Quick test confirms that for b, a := 1, 1
in 1.12.1. Is it always the case or only a coincidence?
Discovered that it's not guaranteed, e.g. for doesn't work for b, c, a := 1, 1, 1
Only function arguments, but IMHO that's 90% of usecases anyway.
@aarzilli if we file a request upstream for the compiler to write these in order, then would it be possible for Delve to return them in order? If yes, then I guess it would satisfy both the original request and the debugging binary size.
if we file a request upstream for the compiler to write these in order, then would it be possible for Delve to return them in order?
I believe it would happen automatically.
Reported here: https://github.com/golang/go/issues/31133