From 9436c5f8b34d695e3dfe95aa54051848cdee3c23 Mon Sep 17 00:00:00 2001 From: "M. Habib Rosyad" Date: Mon, 10 Aug 2020 21:56:29 +0700 Subject: [PATCH] fix vendor/k8s.io/apimachinery/pkg/labels staticcheck --- hack/.staticcheck_failures | 1 - staging/src/k8s.io/apimachinery/pkg/labels/selector.go | 4 ++-- staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 94549364320..b1630ac3216 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -19,7 +19,6 @@ vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation vendor/k8s.io/apimachinery/pkg/conversion -vendor/k8s.io/apimachinery/pkg/labels vendor/k8s.io/apimachinery/pkg/runtime vendor/k8s.io/apimachinery/pkg/runtime/serializer/json vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning diff --git a/staging/src/k8s.io/apimachinery/pkg/labels/selector.go b/staging/src/k8s.io/apimachinery/pkg/labels/selector.go index bf62f98a429..9324a1a6c37 100644 --- a/staging/src/k8s.io/apimachinery/pkg/labels/selector.go +++ b/staging/src/k8s.io/apimachinery/pkg/labels/selector.go @@ -789,12 +789,12 @@ func (p *Parser) parseIdentifiersList() (sets.String, error) { // parseExactValue parses the only value for exact match style func (p *Parser) parseExactValue() (sets.String, error) { s := sets.NewString() - tok, lit := p.lookahead(Values) + tok, _ := p.lookahead(Values) if tok == EndOfStringToken || tok == CommaToken { s.Insert("") return s, nil } - tok, lit = p.consume(Values) + tok, lit := p.consume(Values) if tok == IdentifierToken { s.Insert(lit) return s, nil diff --git a/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go b/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go index 4045f1c2200..aa3fb2e54bc 100644 --- a/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go @@ -141,6 +141,7 @@ func expectMatchDirect(t *testing.T, selector, ls Set) { } } +//lint:ignore U1000 currently commented out in TODO of TestSetMatches func expectNoMatchDirect(t *testing.T, selector, ls Set) { if SelectorFromSet(selector).Matches(ls) { t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls) @@ -241,16 +242,14 @@ func TestLexerSequence(t *testing.T) { {"key<1", []Token{IdentifierToken, LessThanToken, IdentifierToken}}, } for _, v := range testcases { - var literals []string var tokens []Token l := &Lexer{s: v.s, pos: 0} for { - token, lit := l.Lex() + token, _ := l.Lex() if token == EndOfStringToken { break } tokens = append(tokens, token) - literals = append(literals, lit) } if len(tokens) != len(v.t) { t.Errorf("Bad number of tokens for '%s %d, %d", v.s, len(tokens), len(v.t))