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

Update errcheck to address false positives #1274

Closed
Lekensteyn opened this issue Jul 27, 2020 · 2 comments · Fixed by #1319
Closed

Update errcheck to address false positives #1274

Lekensteyn opened this issue Jul 27, 2020 · 2 comments · Fixed by #1319
Assignees
Labels
dependencies Relates to an upstream dependency

Comments

@Lekensteyn
Copy link

Lekensteyn commented Jul 27, 2020

It looks like the forked errcheck package (https://github.com/golangci/errcheck) is two years behind its current upstream (https://github.com/kisielk/errcheck). There are unfortunately some custom commits, so a trivial sync is not possible. What would it take to update it?

Is it possible to upstream some changes and avoid the use of a fork to ensure easy upgrades? (@kisielk @jirfag ?)

I ran into a false-positive errcheck warning with the following code:

package main

import (
	"crypto/sha256"
	"fmt"
)

func main() {
	h := sha256.New()
	h.Write([]byte("food"))
	fmt.Println(h.Sum(nil))
}

Using the golangci/golangci-lint:v1.27.0 Docker image it outputs:

main.go:10:9: Error return value of `h.Write` is not checked (errcheck)
	h.Write([]byte("food"))
	       ^

This issue has been solved upstream two years ago via kisielk/errcheck#137.

Related issues:

@boring-cyborg
Copy link

boring-cyborg bot commented Jul 27, 2020

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@SVilgelm
Copy link
Member

SVilgelm commented Aug 2, 2020

I asked @kisielk here kisielk/errcheck#184 about adding a special code for golangci, so we can use the main repo instead of fork

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

Successfully merging a pull request may close this issue.

3 participants