Name: candiedyaml
Owner: Rancher
Description: YAML for Go
Forked from: cloudfoundry-attic/candiedyaml
Created: 2016-03-22 21:55:14.0
Updated: 2016-03-22 21:55:15.0
Pushed: 2016-04-01 05:43:48.0
Homepage: null
Size: 442
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
YAML for Go
A YAML 1.1 parser with support for YAML 1.2 features
age myApp
rt (
ithub.com/cloudfoundry-incubator/candiedyaml"
mt"
s"
main() {
le, err := os.Open("path/to/some/file.yml")
err != nil {
println("File does not exist:", err.Error())
os.Exit(1)
fer file.Close()
cument := new(interface{})
coder := candiedyaml.NewDecoder(file)
r = decoder.Decode(document)
err != nil {
println("Failed to decode document:", err.Error())
intln("parsed yml into interface:", fmt.Sprintf("%#v", document))
leToWrite, err := os.Create("path/to/some/new/file.yml")
err != nil {
println("Failed to open file for writing:", err.Error())
os.Exit(1)
fer fileToWrite.Close()
coder := candiedyaml.NewEncoder(fileToWrite)
r = encoder.Encode(document)
err != nil {
println("Failed to encode document:", err.Error())
os.Exit(1)
turn