Hi,
Thanks so much for these examples, I was wondering how to print YAML and your repo came up in my searches.
After trying your sample code I noticed that the managed fields where in the output whereas kubectl won't show that.
I found the upstream PR where they disabled it:
https://github.com/kubernetes/kubernetes/pull/96878/files
I put the two things combined in my code and thought I should return the favour and at least mention it:
https://github.com/DavidGamba/dgtools/blob/edd077ad00ff54fe8d6c2f525442981a6ec38617/kdecode/main.go#L108-L126
Regards