summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gorilla/schema/encoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gorilla/schema/encoder.go')
-rw-r--r--vendor/github.com/gorilla/schema/encoder.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/schema/encoder.go b/vendor/github.com/gorilla/schema/encoder.go
index bf1d511e..f0ed6312 100644
--- a/vendor/github.com/gorilla/schema/encoder.go
+++ b/vendor/github.com/gorilla/schema/encoder.go
@@ -57,6 +57,13 @@ func isZero(v reflect.Value) bool {
}
return z
case reflect.Struct:
+ type zero interface {
+ IsZero() bool
+ }
+ if v.Type().Implements(reflect.TypeOf((*zero)(nil)).Elem()) {
+ iz := v.MethodByName("IsZero").Call([]reflect.Value{})[0]
+ return iz.Interface().(bool)
+ }
z := true
for i := 0; i < v.NumField(); i++ {
z = z && isZero(v.Field(i))