MCPcopy
hub / github.com/mitchellh/mapstructure / isStructTypeConvertibleToMap

Function isStructTypeConvertibleToMap

mapstructure.go:1517–1528  ·  view source on GitHub ↗
(typ reflect.Type, checkMapstructureTags bool, tagName string)

Source from the content-addressed store, hash-verified

1515}
1516
1517func isStructTypeConvertibleToMap(typ reflect.Type, checkMapstructureTags bool, tagName string) bool {
1518 for i := 0; i < typ.NumField(); i++ {
1519 f := typ.Field(i)
1520 if f.PkgPath == "" && !checkMapstructureTags { // check for unexported fields
1521 return true
1522 }
1523 if checkMapstructureTags && f.Tag.Get(tagName) != "" { // check for mapstructure tags inside
1524 return true
1525 }
1526 }
1527 return false
1528}
1529
1530func dereferencePtrToStructIfNeeded(v reflect.Value, tagName string) reflect.Value {
1531 if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…