fix: implement forbidigo's suggestion fmt.Println
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6a2470db54
commit
c79f4e811b
@ -5,6 +5,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -42,7 +43,7 @@ func Execute() {
|
||||
func help(*cobra.Command, []string) {
|
||||
err := Root.Usage()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
|
@ -4,7 +4,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -21,7 +21,7 @@ var cmdVersion = &cobra.Command{
|
||||
Short: "Print version information and exit",
|
||||
Long: `All software has versions. This is ` + appName + `'s`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println(getVersion())
|
||||
log.Println(getVersion())
|
||||
return nil
|
||||
},
|
||||
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
||||
|
6
main.go
6
main.go
@ -4,7 +4,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"git.dotya.ml/wanderer/go-xkcdreader/cmd"
|
||||
"git.dotya.ml/wanderer/go-xkcdreader/xkcdreader"
|
||||
@ -15,9 +15,9 @@ var version = cmd.GetShortVersion()
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
|
||||
fmt.Println("Starting " + cmd.GetAppName() + " " + version)
|
||||
log.Println("Starting " + cmd.GetAppName() + " " + version)
|
||||
|
||||
xkcdreader.RunApp()
|
||||
|
||||
fmt.Println("Exited")
|
||||
log.Println("Exited")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user