Debug in Go
This document introduces 3 simple methods to debug Go code.
print & log
printf, which allows you to format the numbers, variables, and strings;
println, which does the same thing as Print, then adds a new line character (\n) at the end of the string passed to it.
log.Print, which prints the string passed as an argument to the standard output stream.
third-party logging frameworks
When you compile and link your Go programs with the gc toolchain on Linux, macOS, FreeBSD or NetBSD, the resulting binaries contain DWARFv4 debugging information that recent versions (≥7.5) of the GDB debugger can use to inspect a live process or a core dump.
```bash go build -gcflags=all="-N -l" ```
Delve is a debugger for the Go programming language.
```bash go get -u github.com/go-delve/delve/cmd/dlv dlv debug github.com/me/foo/cmd/foo ```
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me, replace # with @
- Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here