修复 slice报错
This commit is contained in:
parent
98c6ef9b3f
commit
0490cb7ad2
8
util.go
8
util.go
@ -55,12 +55,18 @@ func arrayUniqueAdd(a []string, add string) []string {
|
||||
}
|
||||
|
||||
func arrayRemoveElement(a []string, r string) []string {
|
||||
i := 0
|
||||
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:]...)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user