Here are my notes from the Golang Boston Meetup 2017-06-27 debugging meeting, such as they are. Corrections/elaborations welcome.
Notes from debugging group. TLDR: fmt.Println is still very common; nobody in the room knew everything -- i.e., there's debugging tricks and techniques that you probably don't know; there's ever so much "upside potential" in the current tools.
Techniques mentioned:
- fmt.Println
- logging
- context.Context
- crash dumps / core files
- process snapshots
- Delve (Go debugger developed by derekparker at CoreOS)
- flame graphs for performance problems
- counters (for when logging overheads are too high; Netflix uses these)
- dtrace
- goroutine visualizations ("Divan" is author ?)
- Jetbrains Gogland (pre-release; based on Delve)
- Visual Studio Go Extensions (VSCode? "good"; also based on Delve)
- profligate git branching as a debugging tool (easy to recover what worked, look for changes that matter)
- go test; write lots of tests, use them.
- pprof
- git bisect
- runtime trace: https://godoc.org/runtime/trace
- vtune
wish list:
- a magic command line arg that would make channels "echo" (log of channel behavior)
- "how did I get from here to there?" (single step is broken sometimes, and the tedious process could be automated)
- "show references" (a reverse garbage collector, "why is this still live?")
- logging, seems like nobody gets it right, we keep on writing our own.
- a refactoring tool, "I need a context here in f, make it so".
- "stack traces" should have an option to provide values of local variables, where possible.
- goimports can be a pain if its default is a wrong guess and packages come and go during hacking; repeating the same wrong-guess correction is annoying.
- when hacking towards a bug diagnosis/fix, would be nice to have forgive variable declared-not-used (it's friction).
- want a tool (gui?) for exploring crash dumps (similar to above for stack traces)
random thoughts/suggestions:
- an idiom-from-stackoverflow recognizer ("hey, we could train a neural net....")
- git stash is dangerous
- (to train better programmers) "Use examples that matter. Just Say No to Fibonnacci." (real world, there's many new programmers for whom Fibonacci is a new thing, it's not as helpful as the math-is-fun crowd thinks)
- what's the latest-greatest in vendoring? some people like "go dep", go vendor can be REALLY slow (150 kloc + 1.5Mloc vendored, 5 minutes)
Additions to notes:
Someone mentioned "go vet", I forgot to write that down.
From the Go team (and my fault for not mentioning these myself): "What about fuzzing? Anyone mention the thread sanitizer?"