Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load the JSON config file
- func Load(configFile string, outputObj interface{}) *errors.ErrorSt {
- var err error
- // Read the config file
- jsonBytes, err := ioutil.ReadFile(configFile)
- if err != nil {
- fmt.Println(err.Error())
- return errors.File().AddDetails(err.Error())
- }
- // Parse the config
- if err := json.Unmarshal(jsonBytes, outputObj); err != nil {
- return errors.JSON().AddDetails("Could not parse" + configFile + ": " + err.Error())
- }
- return nil
- }
Add Comment
Please, Sign In to add comment