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 path in file changed detected message #11271

Merged
merged 3 commits into from
Apr 19, 2024
Merged

Conversation

kd7lxl
Copy link
Contributor

@kd7lxl kd7lxl commented Apr 18, 2024

What this PR does / why we need it:

This log would always print the path of the last file in the list, because f was modified by the for loop after the func was created. Fixed it so that now it prints the name of the file that was modified, which I believe was the original intention.

This is one of the classic mistakes in Go, so much so that they changed the language behavior in go1.22 to prevent it: https://go.dev/blog/loopvar-preview

Also fixed spelling in the log message.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • CVE Report (Scanner found CVE and adding report)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

How Has This Been Tested?

I haven't tested it.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority labels Apr 18, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @kd7lxl. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 18, 2024
@k8s-ci-robot k8s-ci-robot requested review from Gacko and strongjz April 18, 2024 00:05
Copy link

netlify bot commented Apr 18, 2024

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
🔨 Latest commit 4a1e3c4
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/6622828713be080008b55a6d

@@ -202,8 +202,9 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
}

for _, f := range filesToWatch {
f := f
Copy link
Member

@Gacko Gacko Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the fact that it took me some time to understand the root cause and the fix, I'd recommend adding a few lines of docs here. That's probably an easy one for devs deeper into that project and Go in general, but others might drop or refactor that line without further context. Maybe also reference this PR in your comment. Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a link to a doc in the PR description.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but nobody will find that if they are not git blameing and walking through history. So please add some words next to your code addition. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a description of the code to the code.

@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

/triage accepted
/kind bug
/priority backlog

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority labels Apr 19, 2024
@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 19, 2024
@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

/cherry-pick release-1.10

@k8s-infra-cherrypick-robot
Copy link
Contributor

@Gacko: once the present PR merges, I will cherry-pick it on top of release-1.10 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.10

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.

@@ -202,8 +202,9 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
}

for _, f := range filesToWatch {
f := f
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but nobody will find that if they are not git blameing and walking through history. So please add some words next to your code addition. 🙂

@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

/hold

According to the docs you added, this is already fixed in Go 1.22, so there's no change needed. Have you checked that bug against recent controller releases? They should be based on Go 1.22.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 19, 2024
@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

... ok, nevermind. I mixed things up, we are on Go 1.21.

@kd7lxl
Copy link
Contributor Author

kd7lxl commented Apr 19, 2024

/hold

According to the docs you added, this is already fixed in Go 1.22, so there's no change needed. Have you checked that bug against recent controller releases? They should be based on Go 1.22.

Yes, it was tested against the latest release which is on go1.21.

@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

Was mistaking that because of this: https://github.com/kubernetes/ingress-nginx/blob/main/GOLANG_VERSION

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 19, 2024
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2024
@Gacko
Copy link
Member

Gacko commented Apr 19, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gacko, kd7lxl

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 48fbdfe into kubernetes:main Apr 19, 2024
27 checks passed
@k8s-infra-cherrypick-robot
Copy link
Contributor

@Gacko: new pull request created: #11286

In response to this:

/cherry-pick release-1.10

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.

@kd7lxl kd7lxl deleted the f branch May 28, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants