diff --git a/cmd/config.go b/cmd/config.go index 1eaefe6..b825674 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -199,7 +199,7 @@ func (conf *Config) WriteConfigFile() (string, error) { cfgfile := filepath.Join(conf.GetConfigDir(), "config.toml") if FileExists(cfgfile) { - return "", fmt.Errorf("config file %s already exists.", cfgfile) + return "", fmt.Errorf("config file %s already exists", cfgfile) } var kloader = koanf.New(".") diff --git a/cmd/root.go b/cmd/root.go index 83b481c..6af1b43 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -58,7 +58,11 @@ func Execute(output io.Writer) int { return Die(err) } - fmt.Fprintln(output, msg) + _, err = fmt.Fprintln(output, msg) + if err != nil { + return Die(fmt.Errorf("failed to print to output: %s", err)) + } + return 0 }