panic with value res composite types
bug
@jordansissel reports in https://github.com/purpleidea/mgmt/discussions/977
I haven't tested this yet, but it's likely this is our bug. Either we need to catch composite types and disallow with panic, or handle them correctly.
```
$example = struct {
foo => "Hello world",
}
value "example" {
any => $example,
Meta:export => [ "*" ],
}
```
This errors:
```
23:21:47 main: waiting...
23:21:47 gapi: lang: stream...
23:21:47 gapi: lang: function engine starting...
23:21:47 gapi: lang: interpret: interpreting...
panic: struct has unexported field: foo
goroutine 354 [running]:
github.com/purpleidea/mgmt/lang/types.(*Type).Reflect(0xc001283590)
github.com/purpleidea/mgmt/lang/types/type.go:1076 +0xc85
github.com/purpleidea/mgmt/lang/types.(*StructValue).Value(0xc0012925d0)
github.com/purpleidea/mgmt/lang/types/value.go:1413 +0x5b
github.com/purpleidea/mgmt/lang/types.Into({0x3d0c588, 0xc0012925d0}, {0x33967e0?, 0xc000373360?, 0x3?})
```
This also panics even without exporting (no Meta:export => ...)
0 条评论