删除 冗余代码

This commit is contained in:
dengsgo 2019-04-01 16:20:20 +08:00
parent 8d5c11d20d
commit 9004aceb91

33
util.go
View File

@ -6,15 +6,6 @@ import (
"strings"
)
func inStringArray(value string, arr []string) bool {
for _, v := range arr {
if value == v {
return true
}
}
return false
}
func keyInMonitorTypesMap(k string, cfg *FileGirl) bool {
_, ok := cfg.Monitor.TypesMap[k]
return ok
@ -63,30 +54,6 @@ func listFile(folder string, fun func(string)) {
}
}
func arrayUniqueAdd(a []string, add string) []string {
if inStringArray(add, a) {
return a
}
return append(a, add)
}
func arrayRemoveElement(a []string, r string) []string {
i := -1
for k, v := range a {
if v == r {
i = k
break
}
}
if i == -1 {
return a
}
if len(a) == 1 && i == 0 {
return []string{}
}
return append(a[:i], a[i+1:]...)
}
func relativePath(folder, p string) string {
return strings.TrimPrefix(p, folder)
}