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

Function extractNestedMap

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

extractNestedMap walks a path of keys through a nested map structure and returns the map at that path. Returns nil, false if any key is missing or if any intermediate value is not a map.

(m map[string]interface{}, path ...string)

Source from the content-addressed store, hash-verified

47// returns the map at that path. Returns nil, false if any key is missing or
48// if any intermediate value is not a map.
49func extractNestedMap(m map[string]interface{}, path ...string) (map[string]interface{}, bool) {
50 current := m
51 for _, key := range path {
52 v, ok := current[key]
53 if !ok {
54 return nil, false
55 }
56 current, ok = asMap(v)
57 if !ok {
58 return nil, false
59 }
60 }
61 return current, true
62}
63
64type migrateConfigCmd struct {
65 ConfigFile string `arg:"" help:"Path to the 2.x config file"`

Callers 4

detectLegacyOverridesFunction · 0.85
cleanLocalBlocksFunction · 0.85

Calls 1

asMapFunction · 0.85

Tested by

no test coverage detected