code: func SaveConfigToYamlFile(cfg interface{}, path string, perm os.FileMode, comment string) error {
  	bytes, err := yaml.Marshal(cfg)
  	if err != nil {
  		return err
  	}
  
  	if comment != "" {
  		bytes = append([]byte(comment+"\n"), bytes...)
  	}
  
  	err = ioutil.WriteFile(path, bytes, perm)
  	if err != nil {
  		return err
  	}
  	return nil
  }
docs: // SaveConfigToYamlFile saves the configuration <cfg> into a YAML-formatted file
  // at the location <path> with permissions defined by <perm>.
  // <comment>, if non-empty, is printed at the beginning of the file before
  // the configuration is printed (with a line break in between). Each line in <comment>
  // should thus begin with the number sign ( # ).
  // If the file cannot be created af the location, os.PathError is returned.
  // An untyped error is returned if the configuration couldn't be marshaled
  // into the YAML format.