[{TableOfContents}]

!!! 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]
* [https://github.com/golang/go/issues/27681]
* [https://github.com/go-delve/delve/issues/964]
* [https://github.com/go-delve/delve/issues/738]


!!! 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:

%%prettify 
{{{
import "github.com/davecgh/go-spew/spew"
}}}
/%

To dump a variable with full newlines, indentation, type, and pointer information use Dump, Fdump, or Sdump:

%%prettify 
{{{
spew.Dump(myVar1, myVar2, ...)
spew.Fdump(someWriter, myVar1, myVar2, ...)
str := spew.Sdump(myVar1, myVar2, ...)
}}}
/%

!! Delve

Links
* [Using the Go Delve Debugger From the Command Line|https://www.jamessturtevant.com/posts/Using-the-Go-Delve-Debugger-from-the-command-line/]
----
[CategoryComputing.Lang.Go]