mirror of https://github.com/gin-gonic/gin.git
Validate should ignore unexported struct fields.
This commit is contained in:
parent
0808f8a824
commit
e36f2945bb
|
@ -169,8 +169,8 @@ func Validate(obj interface{}) error {
|
||||||
for i := 0; i < typ.NumField(); i++ {
|
for i := 0; i < typ.NumField(); i++ {
|
||||||
field := typ.Field(i)
|
field := typ.Field(i)
|
||||||
|
|
||||||
// Allow ignored fields in the struct
|
// Allow ignored and unexported fields in the struct
|
||||||
if field.Tag.Get("form") == "-" {
|
if field.Tag.Get("form") == "-" || field.PkgPath != "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue