浏览代码

Validate should ignore unexported struct fields.

Andrey Smirnov 11 年之前
父节点
当前提交
e36f2945bb
共有 1 个文件被更改,包括 2 次插入2 次删除
  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++ {
 			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
 			}