@@ -60,11 +60,11 @@ var (
6060// Validate validates the given value and returns the validation error, if any.
6161//
6262// Validate performs validation using the following steps:
63- // 1. For each rule, call its `Validate()` to validate the value. Return if any error is found.
64- // 2. If the value being validated implements `Validatable`, call the value's `Validate()`.
65- // Return with the validation result.
66- // 3. If the value being validated is a map/slice/array, and the element type implements `Validatable`,
67- // for each element call the element value's `Validate()`. Return with the validation result.
63+ // 1. For each rule, call its `Validate()` to validate the value. Return if any error is found.
64+ // 2. If the value being validated implements `Validatable`, call the value's `Validate()`.
65+ // Return with the validation result.
66+ // 3. If the value being validated is a map/slice/array, and the element type implements `Validatable`,
67+ // for each element call the element value's `Validate()`. Return with the validation result.
6868func Validate (value interface {}, rules ... Rule ) error {
6969 for _ , rule := range rules {
7070 if s , ok := rule .(skipRule ); ok && s .skip {
@@ -103,16 +103,16 @@ func Validate(value interface{}, rules ...Rule) error {
103103// ValidateWithContext validates the given value with the given context and returns the validation error, if any.
104104//
105105// ValidateWithContext performs validation using the following steps:
106- // 1. For each rule, call its `ValidateWithContext()` to validate the value if the rule implements `RuleWithContext`.
107- // Otherwise call `Validate()` of the rule. Return if any error is found.
108- // 2. If the value being validated implements `ValidatableWithContext`, call the value's `ValidateWithContext()`
109- // and return with the validation result.
110- // 3. If the value being validated implements `Validatable`, call the value's `Validate()`
111- // and return with the validation result.
112- // 4. If the value being validated is a map/slice/array, and the element type implements `ValidatableWithContext`,
113- // for each element call the element value's `ValidateWithContext()`. Return with the validation result.
114- // 5. If the value being validated is a map/slice/array, and the element type implements `Validatable`,
115- // for each element call the element value's `Validate()`. Return with the validation result.
106+ // 1. For each rule, call its `ValidateWithContext()` to validate the value if the rule implements `RuleWithContext`.
107+ // Otherwise call `Validate()` of the rule. Return if any error is found.
108+ // 2. If the value being validated implements `ValidatableWithContext`, call the value's `ValidateWithContext()`
109+ // and return with the validation result.
110+ // 3. If the value being validated implements `Validatable`, call the value's `Validate()`
111+ // and return with the validation result.
112+ // 4. If the value being validated is a map/slice/array, and the element type implements `ValidatableWithContext`,
113+ // for each element call the element value's `ValidateWithContext()`. Return with the validation result.
114+ // 5. If the value being validated is a map/slice/array, and the element type implements `Validatable`,
115+ // for each element call the element value's `Validate()`. Return with the validation result.
116116func ValidateWithContext (ctx context.Context , value interface {}, rules ... Rule ) error {
117117 for _ , rule := range rules {
118118 if s , ok := rule .(skipRule ); ok && s .skip {
0 commit comments