Skip to content

Commit

Permalink
moving errors interface to be in tags.Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni authored and markbates committed Feb 6, 2020
1 parent 798d64d commit ec4d3a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion form/errors.go → errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package form
package tags

type Errors interface {
Get(key string) []string
Expand Down
8 changes: 4 additions & 4 deletions form/form_for.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type FormFor struct {
name string
dashedName string
reflection reflect.Value
Errors Errors
Errors tags.Errors
}

// NewFormFor creates a new Formfor with passed options, it also creates the id of the form from the struct name and adds errors if present.
Expand Down Expand Up @@ -53,7 +53,7 @@ func NewFormFor(model interface{}, opts tags.Options) *FormFor {
}
}

func loadErrors(opts tags.Options) Errors {
func loadErrors(opts tags.Options) tags.Errors {
errors := validate.NewErrors()

if opts["errors"] == nil {
Expand All @@ -68,8 +68,8 @@ func loadErrors(opts tags.Options) Errors {
Errors: opts["errors"].(map[string][]string),
Lock: new(sync.RWMutex),
}
case Errors:
return opts["errors"].(Errors)
case tags.Errors:
return opts["errors"].(tags.Errors)
}

return errors
Expand Down

0 comments on commit ec4d3a0

Please sign in to comment.