Marshal encodes the properties file
(dst io.Writer, p any)
| 10 | |
| 11 | // Marshal encodes the properties file |
| 12 | func Marshal(dst io.Writer, p any) error { |
| 13 | val := reflect.ValueOf(p) |
| 14 | switch val.Kind() { |
| 15 | case reflect.Struct: |
| 16 | return encodePropsStruct(dst, val) |
| 17 | default: |
| 18 | return fmt.Errorf("Marshal excepts a struct or map, not %s", val.Kind()) |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | func encodePropsStruct(dst io.Writer, v reflect.Value) error { |
| 23 | vt := v.Type() |
no test coverage detected