Recursive AI
oneyamlGoAvailable

oneyaml for Go

encoding/json-style YAML 1.2 and comment-preserving editing for Go, in one package.

go get oneyaml.dev/go

A quick look

Read a file into a struct the way you would with encoding/json, then edit it in place. The edit changes one value, and the comment and every other byte stay.

Getting started
main.goGo
// Typed reads, as with encoding/json
err := oneyaml.Unmarshal(src, &cfg)
 
// The lossless document: edit in place
doc, err := oneyaml.Parse(src)
err = doc.Set("/replicas", 3)
// replicas: 3 # raised by the release job
// Everything else stays byte for byte.

The package

Go further