(value reflect.Value)
| 1030 | } |
| 1031 | |
| 1032 | func configScalarNode(value reflect.Value) (any, bool) { |
| 1033 | switch value.Kind() { |
| 1034 | case reflect.String: |
| 1035 | return value.String(), true |
| 1036 | case reflect.Bool: |
| 1037 | return value.Bool(), true |
| 1038 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: |
| 1039 | return value.Int(), true |
| 1040 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: |
| 1041 | return value.Uint(), true |
| 1042 | case reflect.Float32, reflect.Float64: |
| 1043 | return value.Float(), true |
| 1044 | default: |
| 1045 | if value.CanInterface() { |
| 1046 | return fmt.Sprint(value.Interface()), true |
| 1047 | } |
| 1048 | return nil, false |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | func tomlFieldName(field reflect.StructField) (string, bool, bool) { |
| 1053 | tag := field.Tag.Get("toml") |
no test coverage detected