Nicolas Martyanoff on Nostr: I spend a lot of time debugging #Go code, and using fmt.Printf with %v does not cut ...
I spend a lot of time debugging #Go code, and using fmt.Printf with %v does not cut it. go-spew is way too verbose, so I wrote a pretty printing library. Doing it right is hard; there are a lot of cornercases and the reflect package is a minefield. But it works.
Import go.n16f.net/pp, call pp.Print and you're done.
Partial inline is a life saver, and it's only one of the many little trick I use to make it useful for debugging.
You may find it useful.
https://github.com/galdor/go-pp Published at
2024-11-09 19:44:08Event JSON
{
"id": "f96b38b1278877c0138f46362692937f7768a511ea8e09ecaf258070ff091e28",
"pubkey": "6d91e7b056ab18986298e04a8b278a5e070a726487fd30a599427c79db9070e9",
"created_at": 1731181448,
"kind": 1,
"tags": [
[
"t",
"go"
],
[
"proxy",
"https://fosstodon.org/users/galdor/statuses/113454707438355763",
"activitypub"
]
],
"content": "I spend a lot of time debugging #Go code, and using fmt.Printf with %v does not cut it. go-spew is way too verbose, so I wrote a pretty printing library. Doing it right is hard; there are a lot of cornercases and the reflect package is a minefield. But it works. \n\nImport go.n16f.net/pp, call pp.Print and you're done.\n\nPartial inline is a life saver, and it's only one of the many little trick I use to make it useful for debugging.\n\nYou may find it useful.\n\nhttps://github.com/galdor/go-pp\n\nhttps://cdn.fosstodon.org/media_attachments/files/113/454/704/625/012/500/original/b3270bac12db0cde.png",
"sig": "067b91abf20e0634c809046b84d19d724c102ad243aa44c4a4a90f297e97ec7995960c53ee3184005c07a67d03f12235c54934503ddcde1097e8709536a1ebc6"
}