MCPcopy Create free account
hub / github.com/cloudwan/gohan / LoadMap

Function LoadMap

util/util.go:90–100  ·  view source on GitHub ↗

LoadMap loads map object from file. suffix of filepath will be used as file type. currently, json and yaml is supported

(filePath string)

Source from the content-addressed store, hash-verified

88//LoadMap loads map object from file. suffix of filepath will be
89// used as file type. currently, json and yaml is supported
90func LoadMap(filePath string) (map[string]interface{}, error) {
91 data, err := LoadFile(filePath)
92 if err != nil {
93 return nil, err
94 }
95 d, ok := data.(map[string]interface{})
96 if !ok {
97 return nil, fmt.Errorf("data isn't map")
98 }
99 return d, nil
100}
101
102//LoadFile loads object from file. suffix of filepath will be
103// used as file type. currently, json and yaml is supported

Callers 1

testFileUtilFunction · 0.85

Calls 2

LoadFileFunction · 0.85
ErrorfMethod · 0.65

Tested by 1

testFileUtilFunction · 0.68