add go modules

This commit is contained in:
anton.gurov
2019-10-17 19:57:20 +03:00
parent 83dc2f9007
commit ed22f7a37e
24 changed files with 380 additions and 1520 deletions

24
util/util.go Normal file
View File

@ -0,0 +1,24 @@
package util
import (
"reflect"
)
func InArray(val interface{}, array interface{}) (exists bool, index int) {
exists = false
index = -1
switch reflect.TypeOf(array).Kind() {
case reflect.Slice:
s := reflect.ValueOf(array)
for i := 0; i < s.Len(); i++ {
if reflect.DeepEqual(val, s.Index(i).Interface()) == true {
index = i
exists = true
return
}
}
}
return
}