Skip to content

Update errcheck to address false positives #1274

Closed
@Lekensteyn

Description

@Lekensteyn

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:

Metadata

Metadata

Assignees

Labels

dependenciesRelates to an upstream dependency

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions