cmd: remove redundant nil check (#7083)
From the Go specification: > "3. If the map is nil, the number of iterations is 0." https://go.dev/ref/spec#For_range Therefore, an additional nil check for before the loop is unnecessary.
This commit is contained in:
parent
b17123c575
commit
fc5cb56837
20
cmd/shell.go
20
cmd/shell.go
|
|
@ -442,12 +442,10 @@ func ValidateJSONConfig(cv *ConfigValidator, in io.Reader) error {
|
|||
|
||||
// Initialize the validator and load any custom tags.
|
||||
validate := validator.New()
|
||||
if cv.Validators != nil {
|
||||
for tag, v := range cv.Validators {
|
||||
err := validate.RegisterValidation(tag, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for tag, v := range cv.Validators {
|
||||
err := validate.RegisterValidation(tag, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -486,12 +484,10 @@ func ValidateYAMLConfig(cv *ConfigValidator, in io.Reader) error {
|
|||
|
||||
// Initialize the validator and load any custom tags.
|
||||
validate := validator.New()
|
||||
if cv.Validators != nil {
|
||||
for tag, v := range cv.Validators {
|
||||
err := validate.RegisterValidation(tag, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for tag, v := range cv.Validators {
|
||||
err := validate.RegisterValidation(tag, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue