(zctrl *sbuf.Control)
| 74 | } |
| 75 | |
| 76 | func marshalControl(zctrl *sbuf.Control) (any, error) { |
| 77 | ctrl, ok := zctrl.Message.(*bsupio.Control) |
| 78 | if !ok { |
| 79 | return nil, fmt.Errorf("unknown control type: %T", zctrl.Message) |
| 80 | } |
| 81 | if ctrl.Format != bsupio.ControlFormatSUP { |
| 82 | return nil, fmt.Errorf("unsupported app encoding: %v", ctrl.Format) |
| 83 | } |
| 84 | value, err := sup.ParseValue(super.NewContext(), string(ctrl.Bytes)) |
| 85 | if err != nil { |
| 86 | return nil, fmt.Errorf("unable to parse control message: %w (%s)", err, ctrl.Bytes) |
| 87 | } |
| 88 | var v any |
| 89 | if err := unmarshaler.Unmarshal(value, &v); err != nil { |
| 90 | return nil, fmt.Errorf("unable to unmarshal control message: %w (%s)", err, ctrl.Bytes) |
| 91 | } |
| 92 | return v, nil |
| 93 | } |
no test coverage detected