Skip to content

Commit

Permalink
cmd: Silence warning about logrus.Fatal usage when directive has been…
Browse files Browse the repository at this point in the history
… supplied (#2462)

Update the cmd/[catalog,olm] main packages and silence any vet warnings
about logrus.Fatal usage that supply formatting directives:

```bash
$ go vet ./cmd/...
cmd/catalog/main.go:114:3: Fatal call has possible formatting directive %v
cmd/olm/main.go:123:3: Fatal call has possible formatting directive %v
```

Signed-off-by: timflannagan <timflannagan@gmail.com>
  • Loading branch information
timflannagan authored Dec 6, 2021
1 parent e064f3b commit 3949ceb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions cmd/catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ func main() {
// Check if version flag was set
if *version {
fmt.Print(olmversion.String())

// Exit early
os.Exit(0)
}

Expand All @@ -111,7 +109,7 @@ func main() {

listenAndServe, err := server.GetListenAndServeFunc(server.WithLogger(logger), server.WithTLS(tlsCertPath, tlsKeyPath, clientCAPath), server.WithDebug(*debug))
if err != nil {
logger.Fatal("Error setting up health/metric/pprof service: %v", err)
logger.Fatalf("Error setting up health/metric/pprof service: %v", err)
}

go func() {
Expand All @@ -138,12 +136,12 @@ func main() {
// Create a new instance of the operator.
op, err := catalog.NewOperator(ctx, *kubeConfigPath, utilclock.RealClock{}, logger, *wakeupInterval, *configmapServerImage, *opmImage, *utilImage, *catalogNamespace, k8sscheme.Scheme, *installPlanTimeout, *bundleUnpackTimeout)
if err != nil {
log.Panicf("error configuring catalog operator: %s", err.Error())
log.Fatalf("error configuring catalog operator: %s", err.Error())
}

opCatalogTemplate, err := catalogtemplate.NewOperator(ctx, *kubeConfigPath, logger, *wakeupInterval, *catalogNamespace)
if err != nil {
log.Panicf("error configuring catalog template operator: %s", err.Error())
log.Fatalf("error configuring catalog template operator: %s", err.Error())
}

op.Run(ctx)
Expand Down
12 changes: 6 additions & 6 deletions cmd/olm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func main() {

listenAndServe, err := server.GetListenAndServeFunc(server.WithLogger(logger), server.WithTLS(tlsCertPath, tlsKeyPath, clientCAPath), server.WithDebug(*debug))
if err != nil {
logger.Fatal("Error setting up health/metric/pprof service: %v", err)
logger.Fatalf("Error setting up health/metric/pprof service: %v", err)
}

go func() {
Expand All @@ -131,7 +131,7 @@ func main() {

mgr, err := Manager(ctx, *debug)
if err != nil {
logger.WithError(err).Fatalf("error configuring controller manager")
logger.WithError(err).Fatal("error configuring controller manager")
}
config := mgr.GetConfig()

Expand Down Expand Up @@ -164,7 +164,7 @@ func main() {
olm.WithConfigClient(versionedConfigClient),
)
if err != nil {
logger.WithError(err).Fatalf("error configuring operator")
logger.WithError(err).Fatal("error configuring operator")
return
}

Expand All @@ -173,7 +173,7 @@ func main() {

// Emit CSV metric
if err = op.EnsureCSVMetric(); err != nil {
logger.WithError(err).Fatalf("error emitting metrics for existing CSV")
logger.WithError(err).Fatal("error emitting metrics for existing CSV")
}

if *writeStatusName != "" {
Expand All @@ -187,12 +187,12 @@ func main() {
openshift.WithOLMOperator(),
)
if err != nil {
logger.WithError(err).Fatalf("error configuring openshift integration")
logger.WithError(err).Fatal("error configuring openshift integration")
return
}

if err := reconciler.SetupWithManager(mgr); err != nil {
logger.WithError(err).Fatalf("error configuring openshift integration")
logger.WithError(err).Fatal("error configuring openshift integration")
return
}
}
Expand Down

0 comments on commit 3949ceb

Please sign in to comment.