Procházet zdrojové kódy

Validate should ignore unexported struct fields.

Andrey Smirnov před 11 roky
rodič
revize
e36f2945bb
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      binding/binding.go

+ 2 - 2
binding/binding.go

@@ -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
-			if field.Tag.Get("form") == "-" {
+			// Allow ignored and unexported fields in the struct
+			if field.Tag.Get("form") == "-" || field.PkgPath != "" {
 				continue
 				continue
 			}
 			}