IDEs#
Visual Studio Code#
https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code
GoLand#
Caviats#
Debugging in Go is currently flaky as Delve fails to get the proper objects.
- http://liza.io/are-you-experiencing-shady-output-from-your-go-debugger-try-these-things/
- https://github.com/golang/go/issues/19340
- https://github.com/go-delve/delve/issues/1368
Tools#
There are several tools to help though.
Spew#
https://github.com/davecgh/go-spew
Add this import line to the file you're working in:
import "github.com/davecgh/go-spew/spew"
To dump a variable with full newlines, indentation, type, and pointer information use Dump, Fdump, or Sdump:
spew.Dump(myVar1, myVar2, ...) spew.Fdump(someWriter, myVar1, myVar2, ...) str := spew.Sdump(myVar1, myVar2, ...)
CategoryComputing.Lang.Go