1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package utils func Contains(slice []string, str string) bool { for _, item := range slice { if item == str { return true } } return false } func Remove(slice []string, str string) (result []string) { for _, item := range slice { if item == str { continue } result = append(result, item) } return result }