Skip to content

Commit ab507e8

Browse files
committed
cmd: Silence warning about logrus.Fatal usage when directive has been supplied
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 <[email protected]>
1 parent f254e91 commit ab507e8

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Diff for: cmd/catalog/main.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ func main() {
9292
// Check if version flag was set
9393
if *version {
9494
fmt.Print(olmversion.String())
95-
96-
// Exit early
9795
os.Exit(0)
9896
}
9997

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

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

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

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

149147
op.Run(ctx)

Diff for: cmd/olm/main.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func main() {
120120

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

126126
go func() {
@@ -131,7 +131,7 @@ func main() {
131131

132132
mgr, err := Manager(ctx, *debug)
133133
if err != nil {
134-
logger.WithError(err).Fatalf("error configuring controller manager")
134+
logger.WithError(err).Fatal("error configuring controller manager")
135135
}
136136
config := mgr.GetConfig()
137137

@@ -164,7 +164,7 @@ func main() {
164164
olm.WithConfigClient(versionedConfigClient),
165165
)
166166
if err != nil {
167-
logger.WithError(err).Fatalf("error configuring operator")
167+
logger.WithError(err).Fatal("error configuring operator")
168168
return
169169
}
170170

@@ -173,7 +173,7 @@ func main() {
173173

174174
// Emit CSV metric
175175
if err = op.EnsureCSVMetric(); err != nil {
176-
logger.WithError(err).Fatalf("error emitting metrics for existing CSV")
176+
logger.WithError(err).Fatal("error emitting metrics for existing CSV")
177177
}
178178

179179
if *writeStatusName != "" {
@@ -187,12 +187,12 @@ func main() {
187187
openshift.WithOLMOperator(),
188188
)
189189
if err != nil {
190-
logger.WithError(err).Fatalf("error configuring openshift integration")
190+
logger.WithError(err).Fatal("error configuring openshift integration")
191191
return
192192
}
193193

194194
if err := reconciler.SetupWithManager(mgr); err != nil {
195-
logger.WithError(err).Fatalf("error configuring openshift integration")
195+
logger.WithError(err).Fatal("error configuring openshift integration")
196196
return
197197
}
198198
}

0 commit comments

Comments
 (0)