Xdumpgo Tutorial May 2026

xdumpgo info ./crash core.12345

Sample output:

Executable: /tmp/crash
Core file: core.12345 (PID 12345)
Go version: go1.21.5
Arch: amd64
Number of goroutines: 1
Panic: send on closed channel

Suppose you’re parsing a custom binary protocol with a header:

type MyHeader struct 
    Magic   uint32
    Version uint16
    Length  uint16

func decodeHeader(data []byte) var hdr MyHeader err := xdumpgo.UnmarshalBinary(data, &hdr, xdumpgo.BigEndian) if err == nil fmt.Printf("Header: magic=0x%X, version=%d, len=%d\n", hdr.Magic, hdr.Version, hdr.Length)

Combine with dump:

dumper := xdumpgo.NewDumperWithHook(func(offset uint64, chunk []byte) 
    if offset == 0  decodeHeader(chunk) 
)

To get started, you need to install the package. Open your terminal and run:

go get -u github.com/example/xdumpgo

(Note: Replace the URL with the actual repository path you are using). xdumpgo tutorial

The real power of xdumpgo shines when integrated into your own Go programs.

Create schema.go:

type Event struct 
    TS    uint64
    Len   uint16
    Payload []byte

Then:

xdumpgo -type "Event" -repeated events.log

Output:

EventTS=1700000000, Len=5, Payload=[104 101 108 108 111]

Convert binary dump to JSON (per offset/type):

xdumpgo -type "[]uint16" -json data.bin > dump.json

xdumpgo is optimized for speed, but here’s how to push it further: xdumpgo info

buf := bufio.NewWriterSize(os.Stdout, 1<<20)
dump := xdumpgo.NewStreamDumper(cfg)
dump.SetOutput(buf)
defer buf.Flush()