(path string)
| 15 | } |
| 16 | |
| 17 | func 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected