MCPcopy
hub / github.com/grafana/tempo / yamlFieldNames

Function yamlFieldNames

cmd/tempo-cli/cmd-migrate-config.go:23–37  ·  view source on GitHub ↗

yamlFieldNames returns the set of YAML tag names for the given struct type.

(v interface{})

Source from the content-addressed store, hash-verified

21
22// yamlFieldNames returns the set of YAML tag names for the given struct type.
23func yamlFieldNames(v interface{}) map[string]bool {
24 t := reflect.TypeOf(v)
25 fields := make(map[string]bool, t.NumField())
26 for i := range t.NumField() {
27 tag := t.Field(i).Tag.Get("yaml")
28 if tag == "-" {
29 continue
30 }
31 name, _, _ := strings.Cut(tag, ",")
32 if name != "" {
33 fields[name] = true
34 }
35 }
36 return fields
37}
38
39// asMap asserts that v is a map[string]interface{}, returning false if not.
40// Callers should warn when this fails on user input, as it signals malformed YAML.

Callers 4

detectLegacyOverridesFunction · 0.85
deleteRemovedBlocksFunction · 0.85
modifyOverridesFunction · 0.85
cleanLocalBlocksFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected