I am attempting to learn goyaml, and am having some issues with attempting to produce slices from yaml. I can marshal my struct into this example yaml, but I cannot unmarshal the same yaml back into the struct.
input:
file:
- file: stdin
webservice:
- port: "0000"
address: 0.0.0.0
processing:
regex:
- regex: ^(this)*
mapping: (1) thing
output:
file:
- file: stdout
webservice:
- port: "0000"
address: 0.0.0.0
struct:
type Configuration struct{
Input ioInstance
Processing ProcessingInstance
Output ioInstance
}
type ioInstance struct {
File []FileInstance
Webservice []WebserviceInstance
}
type FileInstance struct {
File string
}
type WebserviceInstance struct {
Port string
Address string
}
type ProcessingInstance struct {
Regex []RegexInstance
}
type RegexInstance struct {
Regex string
Mapping string
}
When testing unmarshaling I'm getting reflect errors, as I understand it I think I may need to re-approach the design without struct slices, I was hoping someone could offer some insight into this?
errors:
panic: reflect: reflect.Value.Set using unaddressable value [recovered]
panic: reflect: reflect.Value.Set using unaddressable value [recovered]
panic: reflect: reflect.Value.Set using unaddressable value