我在讀取 YAML 文件時遇到問題。我認為這是文件結構中的東西,但我不知道是什么。YAML 文件:conf: hits:5 time:5000000代碼:type conf struct { hits int64 `yaml:"hits"` time int64 `yaml:"time"`}func (c *conf) getConf() *conf { yamlFile, err := ioutil.ReadFile("conf.yaml") if err != nil { log.Printf("yamlFile.Get err #%v ", err) } err = yaml.Unmarshal(yamlFile, c) if err != nil { log.Fatalf("Unmarshal: %v", err) } return c}
- 3 回答
- 0 關注
- 308 瀏覽
添加回答
舉報
0/150
提交
取消