fix: implement forbidigo's suggestion fmt.Println
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-05-27 22:28:43 +02:00
parent 6a2470db54
commit c79f4e811b
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 7 additions and 6 deletions

@ -5,6 +5,7 @@ package cmd
import ( import (
"fmt" "fmt"
"log"
"os" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -42,7 +43,7 @@ func Execute() {
func help(*cobra.Command, []string) { func help(*cobra.Command, []string) {
err := Root.Usage() err := Root.Usage()
if err != nil { if err != nil {
fmt.Println(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
os.Exit(0) os.Exit(0)

@ -4,7 +4,7 @@
package cmd package cmd
import ( import (
"fmt" "log"
"os" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -21,7 +21,7 @@ var cmdVersion = &cobra.Command{
Short: "Print version information and exit", Short: "Print version information and exit",
Long: `All software has versions. This is ` + appName + `'s`, Long: `All software has versions. This is ` + appName + `'s`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(getVersion()) log.Println(getVersion())
return nil return nil
}, },
PersistentPostRun: func(cmd *cobra.Command, args []string) { PersistentPostRun: func(cmd *cobra.Command, args []string) {

@ -4,7 +4,7 @@
package main package main
import ( import (
"fmt" "log"
"git.dotya.ml/wanderer/go-xkcdreader/cmd" "git.dotya.ml/wanderer/go-xkcdreader/cmd"
"git.dotya.ml/wanderer/go-xkcdreader/xkcdreader" "git.dotya.ml/wanderer/go-xkcdreader/xkcdreader"
@ -15,9 +15,9 @@ var version = cmd.GetShortVersion()
func main() { func main() {
cmd.Execute() cmd.Execute()
fmt.Println("Starting " + cmd.GetAppName() + " " + version) log.Println("Starting " + cmd.GetAppName() + " " + version)
xkcdreader.RunApp() xkcdreader.RunApp()
fmt.Println("Exited") log.Println("Exited")
} }