Skip to content

Commit 35eec22

Browse files
fix: capture Run() error in metrics controller goroutine (#330)
The goroutine was referencing the outer 'err' variable from metrics.NewController() instead of capturing the return value from metricsController.Run(). By the time the goroutine executes, the outer err is nil (NewController succeeded), so the log line always printed a nil error — making failures impossible to diagnose. Fixes #325
1 parent c6c7386 commit 35eec22

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ func main() {
278278
}
279279
kruisegameInformerFactory.Start(signal.Done())
280280
go func() {
281-
if metricsController.Run(signal) != nil {
282-
setupLog.Error(err, "unable to setup metrics controller")
281+
if runErr := metricsController.Run(signal); runErr != nil {
282+
setupLog.Error(runErr, "unable to setup metrics controller")
283283
os.Exit(1)
284284
}
285285
}()

0 commit comments

Comments
 (0)