Refactor error handling for configz initialization

Improved code readability and limited variable scope as per reviewer's suggestion.
This commit is contained in:
myeunee 2024-10-30 04:53:51 +09:00
parent b390ae24d0
commit 2faaedbe39

View File

@ -169,8 +169,7 @@ func Run(ctx context.Context, cc *schedulerserverconfig.CompletedConfig, sched *
logger.Info("Golang settings", "GOGC", os.Getenv("GOGC"), "GOMAXPROCS", os.Getenv("GOMAXPROCS"), "GOTRACEBACK", os.Getenv("GOTRACEBACK"))
// Configz registration.
cz, err := configz.New("componentconfig")
if err != nil {
if cz, err := configz.New("componentconfig"); err != nil {
return fmt.Errorf("unable to register configz: %s", err)
}
cz.Set(cc.ComponentConfig)