mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
util: use slices package for contains
use slices package to check whether the slice contains the element or not. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
86b5db90bc
commit
1e0254daba
@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -145,7 +146,7 @@ func main() {
|
||||
failedTestFound := false
|
||||
for _, r := range statusList {
|
||||
log.Printf("found context %s with status %s\n", r.GetContext(), r.GetState())
|
||||
if contains([]string{"failed", "failure"}, r.GetState()) {
|
||||
if slices.Contains([]string{"failed", "failure"}, r.GetState()) {
|
||||
log.Printf("found failed test %s\n", r.GetContext())
|
||||
failedTestFound = true
|
||||
// rebase the pr if it is behind the devel branch.
|
||||
@ -253,17 +254,6 @@ func (c *retestConfig) checkRetestLimitReached(prNumber int, msg string) (bool,
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// containers check if slice contains string.
|
||||
func contains(s []string, e string) bool {
|
||||
for _, a := range s {
|
||||
if a == e {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// filterStatusesList returns list of unique and recently updated github RepoStatuses.
|
||||
// Raw github RepoStatus list may contain duplicate and older statuses.
|
||||
func filterStatusList(rawStatusList []*github.RepoStatus) []*github.RepoStatus {
|
||||
|
Reference in New Issue
Block a user