cmd toolbox: handle missing error checks

This commit is contained in:
Simone Gotti 2019-07-02 14:27:32 +02:00
parent b849e2c07e
commit ced6108963
2 changed files with 12 additions and 3 deletions

View File

@ -43,5 +43,5 @@ func expanddirRun(cmd *cobra.Command, args []string) {
log.Fatalf("failed to expand dir %q: %v", expDir, err)
}
io.WriteString(os.Stdout, expDir)
_, _ = io.WriteString(os.Stdout, expDir)
}

View File

@ -15,6 +15,9 @@
package cmd
import (
"log"
"os"
"agola.io/agola/cmd"
"github.com/spf13/cobra"
@ -25,9 +28,15 @@ var CmdToolbox = &cobra.Command{
Short: "toolbox",
Version: cmd.Version,
// just defined to make --version work
Run: func(c *cobra.Command, args []string) { c.Help() },
Run: func(c *cobra.Command, args []string) {
if err := c.Help(); err != nil {
log.Fatal(err)
}
},
}
func Execute() {
CmdToolbox.Execute()
if err := CmdToolbox.Execute(); err != nil {
os.Exit(1)
}
}