mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-16 06:58:20 +00:00
1c4ea5c471
15 lines
328 B
Go
15 lines
328 B
Go
package testutil
|
|||
|
|||
import "reflect"
|
|||
|
|||
// IsEmpty returns true if the struct is empty.
|
|||
func IsEmpty(item interface{}) bool {
|
|||
val := reflect.ValueOf(item)
|
|||
for i := 0; i < val.NumField(); i++ {
|
|||
if !reflect.DeepEqual(val.Field(i).Interface(), reflect.Zero(val.Field(i).Type()).Interface()) {
|
|||
return false
|
|||
}
|
|||
}
|
|||
return true
|
|||
}
|