Skip to content

Commit

Permalink
add missing Engine() to default validator
Browse files Browse the repository at this point in the history
to meet new interface requirements in gin
  • Loading branch information
ashtonian committed May 1, 2018
1 parent 14984d9 commit 9f62099
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _examples/gin-upgrading-overriding/v8_to_v9.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ func (v *defaultValidator) ValidateStruct(obj interface{}) error {
return nil
}

func (v *defaultValidator) Engine() interface{} {
v.lazyinit()
return v.validate
}

func (v *defaultValidator) lazyinit() {
v.once.Do(func() {
v.validate = validator.New()
Expand Down

0 comments on commit 9f62099

Please sign in to comment.