rancher/candiedyaml

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

candiedyaml

YAML for Go

A YAML 1.1 parser with support for YAML 1.2 features

Usage
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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.