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

complex c style for loop false positive #27

Closed
carnott-snap opened this issue Mar 10, 2021 · 1 comment
Closed

complex c style for loop false positive #27

carnott-snap opened this issue Mar 10, 2021 · 1 comment

Comments

@carnott-snap
Copy link

carnott-snap commented Mar 10, 2021

The for loop in the following read function triggers a false positive:

func read(r io.Reader, b []byte) (err error) {
        for i, n := 0, 0; i != len(b); i += n {
                n, err = r.Read(b[i:])
                if err != nil {
                        return err
                }
        }
        return nil
}

Yes, I now know that I should just do io.ReadFull instead; but the reproducer stands.

@sanposhiho
Copy link
Owner

Hi @carnott-snap.

This issue is solved in v0.2.0.

If you use golangci-lint

The version of golangci-lint's wastedassign is now v0.1.3.
And, it is upgraded to the new version in this PR. Please wait for the next golangci-lint release, which will be fixed to use wastedassign v0.2.0.

Thank you for your report. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants