mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-17 07:33:00 -06:00
Review changes
This commit is contained in:
parent
dfb9d63123
commit
a116676814
28 changed files with 282 additions and 270 deletions
|
|
@ -29,7 +29,6 @@ var v *validator.Validate
|
|||
|
||||
// Validation Panic messages
|
||||
const (
|
||||
PointerPanic = "validate function was passed pointer"
|
||||
InvalidPanic = "validate function was passed invalid item"
|
||||
)
|
||||
|
||||
|
|
@ -53,11 +52,9 @@ func init() {
|
|||
|
||||
// Struct validates the passed struct, returning validator.ValidationErrors if invalid, or nil if OK.
|
||||
func Struct(s interface{}) error {
|
||||
switch reflect.ValueOf(s).Kind() {
|
||||
switch reflect.TypeOf(s).Kind() {
|
||||
case reflect.Invalid:
|
||||
panic(InvalidPanic)
|
||||
case reflect.Ptr:
|
||||
panic(PointerPanic)
|
||||
}
|
||||
|
||||
err := v.Struct(s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue