memviz
![GoDoc](https://camo.githubusercontent.com/23ba7c6f21b0c1b33d25b24dc5687b695065999b9b3a2744467b8611b48eb7a9/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f627261646c65796a6b656d702f6d656d76697a3f7374617475732e737667)
How would you rather debug a data structure?
"Pretty" printed |
Visual graph |
(*test.fib)(0xc04204a5a0)({
index: (int) 5,
prev: (*test.fib)(0xc04204a580)({
index: (int) 4,
prev: (*test.fib)(0xc04204a560)({
index: (int) 3,
prev: (*test.fib)(0xc04204a540)({
index: (int) 2,
prev: (*test.fib)(0xc04204a520)({
index: (int) 1,
prev: (*test.fib)(0xc04204a500)({
index: (int) 0,
prev: (*test.fib)(),
prevprev: (*test.fib)()
}),
prevprev: (*test.fib)()
}),
prevprev: (*test.fib)(0xc04204a500)({
index: (int) 0,
prev: (*test.fib)(),
prevprev: (*test.fib)()
})
}),
.
.
.
|
![](https://raw.githubusercontent.com/xvman/memviz/master/.github/fib.svg) |
Usage
memviz
takes a pointer to an arbitrary data structure and generates an easy to understand graph.
Simply pass in your data structure like so: memviz.Map(out, &data)
and then pipe the output into graphviz.
For more complete examples see the tests in memviz_test.go.