memviz
go get -u github.com/bradleyjkemp/memviz
graphviz
brew install graphviz
package main
import (
"bytes"
"fmt"
"github.com/bradleyjkemp/memviz"
)
type basics struct {
int int
string string
slice []string
ptr *string
iface interface{}
}
func main() {
str := "Hello"
b := &basics{
1,
"Hi",
[]string{"Hello", "World"},
&str,
"interfaceValue",
}
buf := &bytes.Buffer{}
memviz.Map(buf, b)
fmt.Println(buf.String())
}
go run main.go > hoge.dot
# create png
dot -Tpng hoge.dot -o hoge.png