https://github.com/ahume/go-yamedit
Modify human maintained YAML files
https://github.com/ahume/go-yamedit
go yaml yaml-parser
Last synced: about 1 year ago
JSON representation
Modify human maintained YAML files
- Host: GitHub
- URL: https://github.com/ahume/go-yamedit
- Owner: ahume
- License: mit
- Created: 2016-12-16T16:19:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T16:26:27.000Z (almost 6 years ago)
- Last Synced: 2025-03-30T14:51:10.564Z (about 1 year ago)
- Topics: go, yaml, yaml-parser
- Language: Go
- Size: 10.7 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yamedit

Allows yaml files that are typically edited by humans to be updated without losing any formatting or comments.
It is not a fully-fledged YAML parser/writer, and only deals with updating values for existing fields in a YAML file. It cannot add new fields or new sub-trees to the data structure.
## Example
```golang
yaml := []byte(`---
apiVersion: v1
kind: Namespace
metadata:
name: platform
labels:
team: pricing`)
path := "/metadata/labels/team"
updated, err := yamedit.Edit(yaml, path, "checkout")
if err != nil {
log.Fatal(err)
}
fmt.Println(updated)
// apiVersion: v1
// kind: Namespace
// metadata:
// name: platform
// labels:
// team: checkout
```