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
Conversation
Hi @gavinfish. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @soltysh |
/ok-to-test |
/retest |
1 similar comment
/retest |
@@ -69,7 +70,7 @@ func selectString(s, spec string) bool { | |||
// last part does not exactly match remaining part of string | |||
case i == (len(parts)-1) && len(s) != (len(part)+next): | |||
match = false | |||
break | |||
break Loop |
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.
@@ -164,6 +164,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 comment
The 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 comment
The 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
// RunReconcile performs the execution | |
func (o *ReconcileOptions) RunReconcile() error { | |
return o.Visitor.Visit(func(info *resource.Info, err error) error { | |
if err != nil { | |
return err | |
} |
3922189
to
2b8e60b
Compare
PTAL @soltysh |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gavinfish, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/test pull-kubernetes-e2e-kind |
@gavinfish: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Fix static check failures for:
Ref #81657
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: