各位大佬,想要提取下面这份yaml, 应该如何定义数据结构来提取呢?
`- import: <xxx_root>/testlist.yaml`
`- test: xxx_invalid_test`
` description: >`
` xxx at a higher priv mode`
` iterations: 2`
` gen_test: xxx_random_test`
` gen_opts: >`
` +datar_cnt=1000`
` +num_of_block=2`
` +enable_invalid_level=1`
` func_test: main_invalid_test`
` sim_opts: >`
` +require_signature=1`
我用github.com/goccy/go-yaml, 做法如下:
`type YamlTestConfig struct {`
` TestName string `yaml:"test"``
` Description string `yaml:"description"``
` GenOptions []string `yaml:"gen_opts"``
` Iteration int `yaml:"iterations"``
` GenTestName string `yaml:"gen_test"``
` FuncTestName string `yaml:"rtl_test"``
` SimOptions []string `yaml:"sim_opts"``
`}`
`type ConfigInformation struct {`
` ImportFile string `yaml:"import"``
` TestConfigs []YamlTestConfig`
`}`
程序一直没有反应,麻烦大佬们指点一下,谢谢!
更多评论
![image.png](https://static.studygolang.com/201218/d716aad641aa70db2548e23441014b69.png)
就是帖子上面的内容
#2