为什么下面的程序不能Go运行?Unmarshal 后地图是空的。我可以做任何更改来正确反序列化它吗?或者我应该最终使用yaml.Node?
package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
func main() {
empYaml := `
employees:
- id: 11
name: Irshad
department: IT
designation: Product Manager
address:
city: Mumba
state: Maharashtra
country: India
`
var result map[string]interface{}
yaml.Unmarshal([]byte(empYaml), &result)
fmt.Println(result)
}
播放网址:https://play.golang.org/p/tG44j15mNjH
不负相思意
相关分类