windows 10 x86_64
go version go1.15.1 windows/amd64
vscode 1.49.2
vscode go extension 0.17.0
I learned something disappointing about debugging Go from VS Code.
Consider the following trivial program extracted from a larger program:
package main
var gvar int
func main() {
var lvar int
gvar = 1
lvar = 1
// To make this program compile.
_ = lvar
}
To my surprise, the debugger doesn't show the global variable in
the "VARIABLES" display. It does show the local variable, and also
shows the local variable's value if you put the mouse cursor over
the variable.
The only way to see the global variable is to add it as an
expression to the "WATCH" display.
I googled this problem and found a posting from 2018 saying the
problem was fixed (
https://github.com/microsoft/vscode-go/issues/1854)
so I don't know why I'm seeing what I'm seeing.
Any ideas/comments?