Restrict cz variable scope within else clause

This commit is contained in:
myeunee 2024-10-30 06:31:06 +09:00
parent 2faaedbe39
commit 9cc65ce872

View File

@ -171,8 +171,9 @@ func Run(ctx context.Context, cc *schedulerserverconfig.CompletedConfig, sched *
// Configz registration. // Configz registration.
if cz, err := configz.New("componentconfig"); err != nil { if cz, err := configz.New("componentconfig"); err != nil {
return fmt.Errorf("unable to register configz: %s", err) return fmt.Errorf("unable to register configz: %s", err)
} else {
cz.Set(cc.ComponentConfig)
} }
cz.Set(cc.ComponentConfig)
// Start events processing pipeline. // Start events processing pipeline.
cc.EventBroadcaster.StartRecordingToSink(ctx.Done()) cc.EventBroadcaster.StartRecordingToSink(ctx.Done())