question
After upgrading Go to version 1.25, during debugging, the debug panel displays “variables are unavailable”.
solve
1. Update DLV version
go get -u github.com/go-delve/delve/cmd/dlv@latest
go install github.com/go-delve/delve/cmd/dlv@latest
2. Check the Delve version
$ dlv version
Delve Debugger
Version: 1.25.2
Build: $Id: af3df277866d7175e816eab14e56611053d4cdea $
3. Configure GoLand by opening Hele->Edit Customer Properties and adding.
dlv.path=GOPATH/bin/dlv.exe
# custom GoLand properties (expand/override 'bin\idea.properties')
dlv.path=D:/GoProject/bin/dlv.exe
4. Restart GoLand
Replenish
delve has three debugging modes:
- `dlv attach pid`: Directly debug a running process (PID is the process ID).
- `dlv debug`: Compiles the source files and begins debugging. The main function is located in the same directory, or you can specify the full path to the main function.
- dlv exec filename: Start debugging from a binary file