Skip to content

Commit 49a5b50

Browse files
committed
fixes #372 separate listener creation from serving
1 parent 2a54103 commit 49a5b50

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

pointer.go

+1-9
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,6 @@ func GetForToken(document interface{}, decodedToken string) (interface{}, reflec
105105
return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider)
106106
}
107107

108-
func isZero(data reflect.Value) bool {
109-
if !data.CanInterface() {
110-
return true
111-
}
112-
tpe := data.Type()
113-
return reflect.DeepEqual(data.Interface(), reflect.Zero(tpe).Interface())
114-
}
115-
116108
func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) {
117109
kind := reflect.Invalid
118110
rValue := reflect.Indirect(reflect.ValueOf(node))
@@ -137,7 +129,7 @@ func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.Nam
137129
case reflect.Map:
138130
kv := reflect.ValueOf(decodedToken)
139131
mv := rValue.MapIndex(kv)
140-
if mv.IsValid() && !isZero(mv) {
132+
if mv.IsValid() && !swag.IsZero(mv) {
141133
return mv.Interface(), kind, nil
142134
}
143135
return nil, kind, fmt.Errorf("object has no key %q", decodedToken)

0 commit comments

Comments
 (0)