Skip to content

Instantly share code, notes, and snippets.

@lamp
Created July 30, 2014 17:45
Show Gist options
  • Select an option

  • Save lamp/bee404a57b12514c3e53 to your computer and use it in GitHub Desktop.

Select an option

Save lamp/bee404a57b12514c3e53 to your computer and use it in GitHub Desktop.
Reading a yaml file in go...maybe
package main
import(
"os"
"log"
"gopkg.in/yaml.v1"
)
type T struct {
A string
B struct { C int; D []int ",flow"}
}
func main(){
config, err := os.Open("config.yml")
if err != nil{
log.Fatal(err)
}
t := T{}
f := make([]byte, 100)
config.Read(f)
error := yaml.Unmarshal([]byte(f), &t)
if error != nil {
log.Fatal(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment