23 lines
516 B
Go
23 lines
516 B
Go
|
package pagerduty
|
||
|
|
||
|
// Takes the result of flatmap.Expand for an array of strings
|
||
|
// and returns a []string
|
||
|
func expandStringList(configured []interface{}) []string {
|
||
|
vs := make([]string, 0, len(configured))
|
||
|
for _, v := range configured {
|
||
|
vs = append(vs, string(v.(string)))
|
||
|
}
|
||
|
return vs
|
||
|
}
|
||
|
|
||
|
// Checks if a slice contains a string
|
||
|
func contains(slice []string, item string) bool {
|
||
|
set := make(map[string]struct{}, len(slice))
|
||
|
for _, s := range slice {
|
||
|
set[s] = struct{}{}
|
||
|
}
|
||
|
|
||
|
_, ok := set[item]
|
||
|
return ok
|
||
|
}
|