Skip to content

Conversation

ivankatliarchuk
Copy link
Contributor

@ivankatliarchuk ivankatliarchuk commented May 20, 2025

Description

Enable copyloopvar linter.

This was fixed in 1.21 and explained why is a bad idea in that go issue golang/go#56010

If copy is required, it should be clearly indicated, and most likely variable should be renamed.

extract from go issue

Changing the semantics is usually a no-op, and when it’s not, it fixes buggy code far more often than it breaks correct code
We built a toolchain with the change and tested a subset of Google’s Go tests and analyzed the resulting failures. The rate of new test failures was approximately 1 in 2,000, but nearly all were previously undiagnosed actual bugs. The rate of spurious test failures (correct code actually broken by the change) was 1 in 50,000.

somehow same linter cathches hidden special characters, that do cause some buggy logic

Screenshot 2025-05-20 at 09 34 52

Checklist

  • Unit tests updated
  • End user documentation updated

@k8s-ci-robot k8s-ci-robot requested a review from mloiseleur May 20, 2025 08:29
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 20, 2025
@k8s-ci-robot k8s-ci-robot requested a review from szuecs May 20, 2025 08:29
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 20, 2025
@ivankatliarchuk ivankatliarchuk force-pushed the chore-linter-copyloopvar-v1 branch from 7cc9332 to 11fd3a8 Compare May 20, 2025 08:37
@mloiseleur
Copy link
Collaborator

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mloiseleur

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4276764 into kubernetes-sigs:master May 20, 2025
14 checks passed
@ivankatliarchuk ivankatliarchuk deleted the chore-linter-copyloopvar-v1 branch May 20, 2025 19:06
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants