func cmdWriteConfig(repo scm.ReadOnlyRepo, config *checks.Config, configPath string) error { config.MinVersion = version content, err := yaml.Marshal(config) if err != nil { return fmt.Errorf("internal error when marshaling config: %s", err) } _ = os.Remove(configPath) return ioutil.WriteFile(configPath, append([]byte(yamlHeader), content...), 0666) }