Skip to content

Commit 2faaedb

Browse files
committed
Refactor error handling for configz initialization
Improved code readability and limited variable scope as per reviewer's suggestion.
1 parent b390ae2 commit 2faaedb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/kube-scheduler/app/server.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ func Run(ctx context.Context, cc *schedulerserverconfig.CompletedConfig, sched *
169169
logger.Info("Golang settings", "GOGC", os.Getenv("GOGC"), "GOMAXPROCS", os.Getenv("GOMAXPROCS"), "GOTRACEBACK", os.Getenv("GOTRACEBACK"))
170170

171171
// Configz registration.
172-
cz, err := configz.New("componentconfig")
173-
if err != nil {
172+
if cz, err := configz.New("componentconfig"); err != nil {
174173
return fmt.Errorf("unable to register configz: %s", err)
175174
}
176175
cz.Set(cc.ComponentConfig)

0 commit comments

Comments
 (0)