(field reflect.StructField)
| 252 | } |
| 253 | |
| 254 | func getFieldName(field reflect.StructField) string { |
| 255 | name := field.Name |
| 256 | tag := field.Tag.Get("yaml") |
| 257 | |
| 258 | // If the tag is not specified, then an exported field can be |
| 259 | // configured via the field name (lowercase), while an unexported |
| 260 | // field can't be configured. |
| 261 | if tag == "" { |
| 262 | if unicode.IsLower(rune(name[0])) { |
| 263 | return "" |
| 264 | } |
| 265 | |
| 266 | return strings.ToLower(name) |
| 267 | } |
| 268 | |
| 269 | // Parse the field name |
| 270 | fieldName := yamlFieldNameParser.FindString(tag) |
| 271 | if fieldName == "-" { |
| 272 | return "" |
| 273 | } |
| 274 | |
| 275 | return fieldName |
| 276 | } |
| 277 | |
| 278 | func getFieldType(t reflect.Type) (string, error) { |
| 279 | // Handle custom data types used in the config |
no test coverage detected