mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
27 lines
299 B
Go
27 lines
299 B
Go
|
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)
|
||
|
}
|