Explorar o código

#95 struct and empty struct is considered as notempty

Tao Wen %!s(int64=8) %!d(string=hai) anos
pai
achega
e260979001
Modificáronse 1 ficheiros con 2 adicións e 7 borrados
  1. 2 7
      feature_reflect_object.go

+ 2 - 7
feature_reflect_object.go

@@ -1092,12 +1092,7 @@ func (encoder *structEncoder) EncodeInterface(val interface{}, stream *Stream) {
 }
 
 func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool {
-	for _, field := range encoder.fields {
-		if !field.encoder.IsEmpty(ptr) {
-			return false
-		}
-	}
-	return true
+	return false
 }
 
 type emptyStructEncoder struct {
@@ -1112,5 +1107,5 @@ func (encoder *emptyStructEncoder) EncodeInterface(val interface{}, stream *Stre
 }
 
 func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool {
-	return true
+	return false
 }