You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
557 B
21 lines
557 B
package lncfg |
|
|
|
// Validator is a generic interface for validating sub configurations. |
|
type Validator interface { |
|
// Validate returns an error if a particular configuration is invalid or |
|
// insane. |
|
Validate() error |
|
} |
|
|
|
// Validate accepts a variadic list of Validators and checks that each one |
|
// passes its Validate method. An error is returned from the first Validator |
|
// that fails. |
|
func Validate(validators ...Validator) error { |
|
for _, validator := range validators { |
|
if err := validator.Validate(); err != nil { |
|
return err |
|
} |
|
} |
|
|
|
return nil |
|
}
|
|
|