"go-search" is a simple library to find elements in a slice. It accepts multiple input types. It's been written in 30 minutes (including travis, tests and doc), so bugs are likely to appear, yes :)
Click to view documentation (auto-generated)
go get github.com/magdkudama/go-search
package main
import (
"github.com/magdkudama/search"
"fmt"
)
func main() {
elements := []string{"hey","gopher","you","rule"}
found, pos, err := search.Search("gopher")
fmt.Println("Was element found?: ", found)
fmt.Println("In what position?: ", pos)
fmt.Println("Any error?: ", err)
}
- Magd Kudama [magdkudama]