code: func saveConfig(configName string, data map[string]string) error {
  	klog.V(4).Info(log("saving config file %s", configName))
  
  	dir := path.Dir(configName)
  	if _, err := os.Stat(dir); err != nil {
  		if !os.IsNotExist(err) {
  			return err
  		}
  		klog.V(4).Info(log("creating config dir for config data: %s", dir))
  		if err := os.MkdirAll(dir, 0750); err != nil {
  			klog.Error(log("failed to create config data dir %v", err))
  			return err
  		}
  	}
  
  	file, err := os.Create(configName)
  	if err != nil {
  		klog.V(4).Info(log("failed to save config data file %s: %v", configName, err))
  		return err
  	}
  	defer file.Close()
  	if err := gob.NewEncoder(file).Encode(data); err != nil {
  		klog.Error(log("failed to save config %s: %v", configName, err))
  		return err
  	}
  	klog.V(4).Info(log("config data file saved successfully as %s", configName))
  	return nil
  }
docs: // saveConfig saves the configuration data to local disk