Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix vendor/k8s.io/apimachinery/pkg/labels staticcheck #93860

Merged
merged 1 commit into from Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion hack/.staticcheck_failures
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions staging/src/k8s.io/apimachinery/pkg/labels/selector.go
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down