MCPcopy Index your code
hub / github.com/cloudfoundry/cli / NewMap

Function NewMap

util/generic/map.go:22–53  ·  view source on GitHub ↗
(data ...interface{})

Source from the content-addressed store, hash-verified

20}
21
22func NewMap(data ...interface{}) Map {
23 if len(data) == 0 {
24 return newEmptyMap()
25 } else if len(data) > 1 {
26 panic("NewMap called with more than one argument")
27 }
28
29 switch data := data[0].(type) {
30 case nil:
31 return newEmptyMap()
32 case Map:
33 return data
34 case map[string]string:
35 stringMap := newEmptyMap()
36 for key, val := range data {
37 stringMap.Set(key, val)
38 }
39 return stringMap
40 case map[string]interface{}:
41 stringToInterfaceMap := newEmptyMap()
42 for key, val := range data {
43 stringToInterfaceMap.Set(key, val)
44 }
45 return stringToInterfaceMap
46 case map[interface{}]interface{}:
47 mapp := ConcreteMap(data)
48 return &mapp
49 }
50
51 fmt.Printf("\n\n map: %T", data)
52 panic("NewMap called with unexpected argument")
53}
54
55type Iterator func(key, val interface{})
56

Callers 15

push_test.goFile · 0.92
ToFieldsMethod · 0.92
manifest_test.goFile · 0.92
parseManifestFunction · 0.92
NewEmptyManifestFunction · 0.92
ApplicationsMethod · 0.92
getAppMapsMethod · 0.92
expandPropertiesFunction · 0.92
envVarOrEmptyMapFunction · 0.92
parseDockerFunction · 0.92
generateDescriptionFunction · 0.92
ExceptMethod · 0.85

Calls 4

newEmptyMapFunction · 0.85
ConcreteMapTypeAlias · 0.85
SetMethod · 0.65
PrintfMethod · 0.65

Tested by

no test coverage detected