From e36f2945bbc380f7520b44b4db0d0f166b6ae445 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 7 Oct 2014 01:52:18 +0400 Subject: [PATCH] Validate should ignore unexported struct fields. --- binding/binding.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binding/binding.go b/binding/binding.go index 61a57b1..a40aa74 100644 --- a/binding/binding.go +++ b/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 }