Skip to content

Commit

Permalink
refactor(root_config): remove redundant nil check in Init
Browse files Browse the repository at this point in the history
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 <engzerjun@gmail.com>
  • Loading branch information
Juneezee committed Sep 1, 2023
1 parent 0a02805 commit ce305a9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions config/root_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit ce305a9

Please sign in to comment.