-
Notifications
You must be signed in to change notification settings - Fork 1.4k
excluded_if panic on nil tag parameter #1320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
on Structure fields values {nil, nil} panics too panic: Bad field type *int [recovered] goroutine 10 [running]: |
add check if is param values is nil and field value is pointer than compare |
Package version eg. v9, v10:
V10
Issue, Question or Enhancement:
tag excluded_if
app panics on nil field value in tag param
Code sample, to showcase or reproduce:
Output
panic: strconv.ParseInt: parsing "nil": invalid syntax [recovered]
panic: strconv.ParseInt: parsing "nil": invalid syntax
goroutine 21 [running]:
testing.tRunner.func1.2({0x10335e0, 0xc0000d6f20})
C:/Program Files/Go/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
C:/Program Files/Go/src/testing/testing.go:1548 +0x397
panic({0x10335e0?, 0xc0000d6f20?})
C:/Program Files/Go/src/runtime/panic.go:914 +0x21f
github.com/go-playground/validator/v10.panicIf(...)
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/util.go:294
github.com/go-playground/validator/v10.asInt({0x102bb2a?, 0x104c5c0?})
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/util.go:229 +0x48
github.com/go-playground/validator/v10.requireCheckFieldValue({0x10d62b8, 0xc0000bcb40}, {0x102bb28, 0x1}, {0x102bb2a, 0x3}, 0xf?)
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/baked_in.go:1816 +0x167
github.com/go-playground/validator/v10.excludedIf({0x10d62b8, 0xc0000bcb40})
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/baked_in.go:1869 +0xac
github.com/go-playground/validator/v10.New.wrapFunc.func2({0xc0000bcb40?, 0x102d580?}, {0x10d62b8?, 0xc0000bcb40?})
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/baked_in.go:43 +0x27
github.com/go-playground/validator/v10.(*validate).traverseField(0xc0000bcb40, {0x10d50a8, 0x12a0b00}, {0x104c5c0?, 0xc0000d6ea0?, 0x110?}, {0x102d580?, 0xc0000d6ea8?, 0x196ecb71268?}, {0xc0000a21c0, ...}, ...)
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/validator.go:456 +0x10ce
github.com/go-playground/validator/v10.(*validate).validateStruct(0xc0000bcb40, {0x10d50a8, 0x12a0b00}, {0x104c5c0?, 0xc0000d6ea0?, 0xc000049eb8?}, {0x104c5c0?, 0xc0000d6ea0?, 0x10?}, {0x10d7ae0, ...}, ...)
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/validator.go:78 +0x745
github.com/go-playground/validator/v10.(*Validate).StructCtx(0xc0000ba540, {0x10d50a8, 0x12a0b00}, {0x104c5c0?, 0xc0000d6ea0?})
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/validator_instance.go:395 +0x445
github.com/go-playground/validator/v10.(*Validate).Struct(...)
C:/Users/Kirill/GolandProjects/pkg/mod/github.com/go-playground/validator/[email protected]/validator_instance.go:368
git.fg13.net/roolz/roolz-pkg-core/validator.(*MapRulesValidator).Struct(...)
C:/Users/Kirill/GolandProjects/roolz-pkg-core/validator/validator_benchmark.go:134
git.fg13.net/roolz/roolz-pkg-core/validator_test.TestN(0xc000084680)
C:/Users/Kirill/GolandProjects/roolz-pkg-core/validator/validator_test.go:165 +0x93
testing.tRunner(0xc000084680, 0x1095600)
C:/Program Files/Go/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
C:/Program Files/Go/src/testing/testing.go:1648 +0x3ad
The text was updated successfully, but these errors were encountered: