mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2024-11-10 06:54:16 +00:00
review changes
This commit is contained in:
parent
a116676814
commit
32fe2282c4
1 changed files with 1 additions and 12 deletions
|
@ -27,11 +27,6 @@ import (
|
|||
|
||||
var v *validator.Validate
|
||||
|
||||
// Validation Panic messages
|
||||
const (
|
||||
InvalidPanic = "validate function was passed invalid item"
|
||||
)
|
||||
|
||||
func ulidValidator(fl validator.FieldLevel) bool {
|
||||
field := fl.Field()
|
||||
|
||||
|
@ -52,13 +47,7 @@ func init() {
|
|||
|
||||
// Struct validates the passed struct, returning validator.ValidationErrors if invalid, or nil if OK.
|
||||
func Struct(s interface{}) error {
|
||||
switch reflect.TypeOf(s).Kind() {
|
||||
case reflect.Invalid:
|
||||
panic(InvalidPanic)
|
||||
}
|
||||
|
||||
err := v.Struct(s)
|
||||
return processValidationError(err)
|
||||
return processValidationError(v.Struct(s))
|
||||
}
|
||||
|
||||
func processValidationError(err error) error {
|
||||
|
|
Loading…
Reference in a new issue