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
Staticcheck: vendor/k8s.io/kubectl/pkg/cmd/set and .../edit #87405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -175,6 +175,9 @@ func (o *SetSelectorOptions) RunSelector() error { | |||||||||||||
r := o.ResourceFinder.Do() | ||||||||||||||
|
||||||||||||||
return r.Visit(func(info *resource.Info, err error) error { | ||||||||||||||
if err != nil { | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might change behaviour, since we'll break earlier can you double check that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree. But I think precheck here makes sense. Similar logic at reconcile kubernetes/pkg/kubectl/cmd/auth/reconcile.go Lines 192 to 197 in 5488fe5
|
||||||||||||||
return err | ||||||||||||||
} | ||||||||||||||
patch := &Patch{Info: info} | ||||||||||||||
|
||||||||||||||
if len(o.resourceVersion) != 0 { | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed, this works just fine and is only needed when two or more loops is in effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to add a break in switch cases for go. I think the logic here is to skip the for loop once the
match
variable is set as false.