package valid var ( // ErrNilOrNotEmpty is the error that returns when a value is not nil and is empty. ErrNilOrNotEmpty = NewError("validation_nil_or_not_empty_required", "cannot be blank") ) var ( // Skip is a special validation rule that indicates all rules following it should be skipped. Skip = skipRule{skip: true} ) type skipRule struct { skip bool } func (r skipRule) Validate(interface{}) error { return nil } // When determines if all rules following it should be skipped. func (r skipRule) When(condition bool) skipRule { r.skip = condition return r }