diff --git a/pkg/scheduler/algorithm/predicates/utils.go b/pkg/scheduler/algorithm/predicates/utils.go index 3115b4e8391..1386c93d54f 100644 --- a/pkg/scheduler/algorithm/predicates/utils.go +++ b/pkg/scheduler/algorithm/predicates/utils.go @@ -67,7 +67,7 @@ func FilterPodsByNamespace(pods []*v1.Pod, ns string) []*v1.Pod { // CreateSelectorFromLabels is used to define a selector that corresponds to the keys in a map. func CreateSelectorFromLabels(aL map[string]string) labels.Selector { - if aL == nil || len(aL) == 0 { + if len(aL) == 0 { return labels.Everything() } return labels.Set(aL).AsSelector() diff --git a/staging/src/k8s.io/apimachinery/pkg/util/naming/from_stack.go b/staging/src/k8s.io/apimachinery/pkg/util/naming/from_stack.go index 2965d5a8bc5..d69bf32caa8 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/naming/from_stack.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/naming/from_stack.go @@ -82,7 +82,7 @@ var stackCreator = regexp.MustCompile(`(?m)^created by (.*)\n\s+(.*):(\d+) \+0x[ func extractStackCreator() (string, int, bool) { stack := debug.Stack() matches := stackCreator.FindStringSubmatch(string(stack)) - if matches == nil || len(matches) != 4 { + if len(matches) != 4 { return "", 0, false } line, err := strconv.Atoi(matches[3])