MCPcopy Create free account
hub / github.com/codegangsta/gin / LoadConfig

Function LoadConfig

lib/config.go:17–33  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

15}
16
17func LoadConfig(path string) (*Config, error) {
18 configFile, err := os.Open(path)
19
20 if err != nil {
21 return nil, fmt.Errorf("Unable to read configuration file %s", path)
22 }
23
24 config := new(Config)
25
26 decoder := json.NewDecoder(configFile)
27 err = decoder.Decode(&config)
28 if err != nil {
29 return nil, fmt.Errorf("Unable to parse configuration file %s", path)
30 }
31
32 return config, nil
33}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected