Minor refactor to run additional targets recursively
This commit is contained in:
parent
2154657d34
commit
cccbb1ad25
2 changed files with 81 additions and 52 deletions
|
|
@ -61,3 +61,21 @@ func GitCommit() string {
|
|||
|
||||
return strings.TrimRight(string(stdout), "\n")
|
||||
}
|
||||
|
||||
// NOTE: would it be better to use slices.DeleteFunc instead
|
||||
func RemoveIndex[T comparable](s []T, index int) []T {
|
||||
ret := make([]T, 0)
|
||||
ret = append(ret, s[:index]...)
|
||||
return append(ret, s[index+1:]...)
|
||||
}
|
||||
|
||||
func CopyIf[T comparable](s []T, condition func(t T) bool) []T {
|
||||
var f = make([]T, 0)
|
||||
for _, e := range s {
|
||||
if condition(e) {
|
||||
f = append(f, e)
|
||||
}
|
||||
}
|
||||
|
||||
return f
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue