Merge pull request #84957 from ZP-AlwaysWin/dev-1105-1

Remove unnecessary judgment
This commit is contained in:
Kubernetes Prow Robot 2019-11-12 04:48:43 -08:00 committed by GitHub
commit 35de7a2537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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. // CreateSelectorFromLabels is used to define a selector that corresponds to the keys in a map.
func CreateSelectorFromLabels(aL map[string]string) labels.Selector { func CreateSelectorFromLabels(aL map[string]string) labels.Selector {
if aL == nil || len(aL) == 0 { if len(aL) == 0 {
return labels.Everything() return labels.Everything()
} }
return labels.Set(aL).AsSelector() return labels.Set(aL).AsSelector()

View File

@ -82,7 +82,7 @@ var stackCreator = regexp.MustCompile(`(?m)^created by (.*)\n\s+(.*):(\d+) \+0x[
func extractStackCreator() (string, int, bool) { func extractStackCreator() (string, int, bool) {
stack := debug.Stack() stack := debug.Stack()
matches := stackCreator.FindStringSubmatch(string(stack)) matches := stackCreator.FindStringSubmatch(string(stack))
if matches == nil || len(matches) != 4 { if len(matches) != 4 {
return "", 0, false return "", 0, false
} }
line, err := strconv.Atoi(matches[3]) line, err := strconv.Atoi(matches[3])