From c00f686a74fed1f385c2e55259c5ce8537270a63 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sun, 27 Sep 2015 08:15:49 +1000 Subject: [PATCH] init --- yaml.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 yaml.go diff --git a/yaml.go b/yaml.go new file mode 100644 index 00000000..3b4c5a98 --- /dev/null +++ b/yaml.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "gopkg.in/yaml.v2" + "log" +) + +var data = ` +a: Easy! +b: + c: 2 + d: [3, 4] +` + +func main() { + var m interface{} + + err := yaml.Unmarshal([]byte(data), &m) + if err != nil { + log.Fatalf("error: %v", err) + } + + fmt.Println("Hello, 世界") + fmt.Println(m) +}