From ce305a9f54cd88d1c7e1ab44bb00c9f3f07bb95f Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Fri, 1 Sep 2023 19:43:53 +0800 Subject: [PATCH] refactor(root_config): remove redundant nil check in `Init` From the Go specification: "3. If the map is nil, the number of iterations is 0." [1] Therefore, an additional nil check for before the loop is unnecessary. [1]: https://go.dev/ref/spec#For_range Signed-off-by: Eng Zer Jun --- config/root_config.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/config/root_config.go b/config/root_config.go index 724af48ab0..17a0380fe0 100644 --- a/config/root_config.go +++ b/config/root_config.go @@ -167,12 +167,9 @@ func (rc *RootConfig) Init() error { } // init registry - registries := rc.Registries - if registries != nil { - for _, reg := range registries { - if err := reg.Init(); err != nil { - return err - } + for _, reg := range rc.Registries { + if err := reg.Init(); err != nil { + return err } }