Tuesday, July 23, 2024
HomeGolangModify yaml information utilizing golang - Technical Dialogue

Modify yaml information utilizing golang – Technical Dialogue


I’ve been making an attempt for a pair days now to do one thing that I assumed could be easy. I merely need to modify a selected key worth (many layers deep) in a docker compose yaml file however go away the remainder of the file intact (together with feedback). Docker compose information to not have a properly outlined construction, so every file could have a special schema.

So far as I can inform, the usual golang yaml libraries don’t help something like what I’m in search of. I’ve by no means been in a position to unmarshal / marshal a docker compose yaml file utilizing map[string]interface{} and have it look something like the unique. Many components of the file are lacking once I do this. Utilizing unmarshal / marshal with yaml.Node generates errors from the marshal name. Briefly, I can not even enmarshal / marshal a docker compose yaml file a lot much less modify it.

The one golang package deal that comes near what I an making an attempt to do is yamled (yamled package deal – github.com/vmware-labs/go-yaml-edit – Go Packages). Sadly, this package deal is not supported and doesn’t even construct.

Anybody have thought on learn how to accomplish one thing that I assumed could be very simple?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments