code: func loadConfig(path string) (config, error) {
  	var ret config
  
  	if path == "" {
  		return ret, nil
  	}
  
  	file, err := os.Open(path)
  	switch {
  	case err == nil:
  		defer file.Close()
  
  		decoder := json.NewDecoder(file)
  		if err = decoder.Decode(&ret); err != nil {
  			return ret, errors.Annotate(err, "failed to decode file").Err()
  		}
  		return ret, nil
  
  	case os.IsNotExist(err):
  		// The file does not exist. We don't consider this an error, since the file
  		// is optional.
  		return ret, nil
  
  	default:
  		// An unexpected failure occurred.
  		return ret, errors.Annotate(err, "failed to open file").Err()
  	}
  }
docs: // loadConfig loads a tsmon JSON config from a file.