Browse Source

CheckSliceEquility hinzugefügt

master
Klaus Wendel 2 years ago
parent
commit
062af590b8
  1. 11
      ebkTools.go

11
ebkTools.go

@ -140,6 +140,17 @@ func InArray(array interface{}, value interface{}) (exists bool, index int) {
return
}
// All Values in Array are equal
func CheckSliceEquility(myslice interface{}) bool {
if reflect.ValueOf(myslice).Len() > 1 {
return reflect.DeepEqual(
reflect.ValueOf(myslice).Slice(1, reflect.ValueOf(myslice).Len()).Interface(),
reflect.ValueOf(myslice).Slice(0, reflect.ValueOf(myslice).Len()-1).Interface())
} else {
return true // One single value is always equal to itself
}
}
// Check error code
func Check(e error) {
if e != nil {

Loading…
Cancel
Save