checkMemberList is the library helper check data in slice
go get github.com/subalgo/checkMemberList
checkMemberList.StringIn([]string, string) //check string in []string
checkMemberList.IntIn([]int, int) // check int in []int
checkMemberList.Int64In([]int64, int64) // check int64 in []int64
checkMemberList.Float32In([]Float32, Float32) // check float32 in []float32
checkMemberList.Float64In([]Float64, Float64) // check float64 in []float64
package main
import (
"fmt"
"github.com/subalgo/checkMemberList"
)
func main() {
var mySlice = []string{"apple", "banana"}
res := checkMemberList.StringIn(mySlice, "banana")
fmt.Println(res) // true
res2 := checkMemberList.StringIn(mySlice, "mango")
fmt.Println(res2) // false
}