我正在嘗試映射死的簡單yaml配置文件,以使用此軟件包進(jìn)行結(jié)構(gòu),但沒有成功。config.yamlDrivers: - "/Volumes/V1" - "/Volumes/V2"去type Iconfig struct { Drivers []string `yaml:"Drivers,flow"`}iconfig := Iconfig{}uerr := yaml.UnmarshalStrict(config_yaml, iconfig)uerr:panic: reflect: reflect.Value.Set using unaddressable value [recovered] panic: reflect: reflect.Value.Set using unaddressable valuefmt.Println(string(config_yaml)):Drivers: - "/Volumes/V1" - "/Volumes/V2"為什么“/Volumes/V1”被認(rèn)為是不可尋址的值?
1 回答

慕無忌1623718
TA貢獻(xiàn)1744條經(jīng)驗(yàn) 獲得超4個(gè)贊
嘗試將你的行更改為:
uerr := yaml.UnmarshalStrict(config_yaml, &iconfig)
- 1 回答
- 0 關(guān)注
- 160 瀏覽
添加回答
舉報(bào)
0/150
提交
取消