mirror of
https://github.com/docker/compose.git
synced 2026-07-10 10:14:13 +00:00
refactor: use slices.Contains to simplify code
Signed-off-by: tongjicoder <tongjicoder@icloud.com>
This commit is contained in:
parent
d49a68ecbf
commit
2e71440bee
14 changed files with 32 additions and 47 deletions
|
|
@ -21,16 +21,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// StringContains check if an array contains a specific value
|
||||
func StringContains(array []string, needle string) bool {
|
||||
for _, val := range array {
|
||||
if val == needle {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// StringToBool converts a string to a boolean ignoring errors
|
||||
func StringToBool(s string) bool {
|
||||
s = strings.ToLower(strings.TrimSpace(s))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue