Skip to content

Commit e7772ea

Browse files
committed
Setting SilenceErrors to true to stop printing errors twice when the tool errors
Signed-off-by: Raghav Roy <[email protected]>
1 parent 78c7c69 commit e7772ea

File tree

8 files changed

+16
-4
lines changed

8 files changed

+16
-4
lines changed

cmd/audit.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package cmd
1818

1919
import (
2020
"fmt"
21-
"github.com/pkg/errors"
2221
"io/ioutil"
2322
"net/http"
2423
"os"
@@ -30,6 +29,8 @@ import (
3029
"sync"
3130
"time"
3231

32+
"github.com/pkg/errors"
33+
3334
"github.com/spf13/cobra"
3435
"k8s.io/apimachinery/pkg/util/sets"
3536

@@ -50,6 +51,7 @@ func getDefaultKubernetesDirectory() string {
5051

5152
func init() {
5253
auditCmd.Flags().StringVar(&kubernetesDirectory, "kubernetes-directory", getDefaultKubernetesDirectory(), "path to kubernetes directory")
54+
auditCmd.SilenceErrors = true
5355
rootCmd.AddCommand(auditCmd)
5456
}
5557

cmd/checkurl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var yamlFile string
3232

3333
func init() {
3434
checkURLsCmd.Flags().StringVar(&yamlFile, "yaml-file", "sigs.yaml", "validate urls in this yaml file")
35+
checkURLsCmd.SilenceErrors = true
3536
rootCmd.AddCommand(checkURLsCmd)
3637
}
3738

cmd/export.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ package cmd
1818

1919
import (
2020
"fmt"
21-
"github.com/spf13/cobra"
2221
"os"
2322
"sort"
2423
"strings"
2524
"time"
2625

26+
"github.com/spf13/cobra"
27+
2728
"k8s.io/apimachinery/pkg/util/sets"
2829

2930
"github.com/dims/maintainers/pkg/utils"
@@ -51,6 +52,7 @@ var outputFile string
5152

5253
func init() {
5354
exportCmd.Flags().StringVar(&outputFile, "output", "export.csv", "output file path")
55+
exportCmd.SilenceErrors = true
5456
rootCmd.AddCommand(exportCmd)
5557
}
5658

cmd/labels.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ package cmd
1818

1919
import (
2020
"fmt"
21-
"github.com/spf13/cobra"
2221
"os"
2322
"sort"
2423
"time"
2524

25+
"github.com/spf13/cobra"
26+
2627
"k8s.io/apimachinery/pkg/util/sets"
2728

2829
"github.com/dims/maintainers/pkg/utils"
@@ -50,6 +51,7 @@ var labelsFile string
5051

5152
func init() {
5253
labelsCmd.Flags().StringVar(&labelsFile, "output", "labels.csv", "output file path")
54+
labelsCmd.SilenceErrors = true
5355
rootCmd.AddCommand(labelsCmd)
5456
}
5557

cmd/prettify.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ var prettifyCmd = &cobra.Command{
8888
}
8989

9090
func init() {
91+
prettifyCmd.SilenceErrors = true
9192
rootCmd.AddCommand(prettifyCmd)
9293
}
9394

cmd/prune.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ package cmd
1818

1919
import (
2020
"fmt"
21-
"github.com/spf13/cobra"
2221
"os"
2322
"path/filepath"
2423
"sort"
2524
"strings"
2625
"time"
2726

27+
"github.com/spf13/cobra"
28+
2829
"k8s.io/apimachinery/pkg/util/sets"
2930

3031
"github.com/dims/maintainers/pkg/utils"
@@ -46,6 +47,7 @@ func init() {
4647
pruneCmd.Flags().StringVar(&periodDS, "period-devstats", "y", "one of \"y\" (year) \"q\" (quarter) \"m\" (month) ")
4748
pruneCmd.Flags().StringSliceVar(&excludeFiles, "exclude-files", []string{}, "do not update these OWNERS files")
4849
rootCmd.CompletionOptions.DisableDefaultCmd = true
50+
pruneCmd.SilenceErrors = true
4951
rootCmd.AddCommand(pruneCmd)
5052
}
5153

cmd/validate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,6 @@ func validateOwnersFilesInGroups(groupMap *map[string][]utils.Group) (map[string
139139
}
140140

141141
func init() {
142+
validateCmd.SilenceErrors = true
142143
rootCmd.AddCommand(validateCmd)
143144
}

cmd/version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
)
2424

2525
func init() {
26+
versionCmd.SilenceErrors = true
2627
rootCmd.AddCommand(versionCmd)
2728
}
2829

0 commit comments

Comments
 (0)