It is expected to get an errcheck lint error in the following program.
errcheck reports but golangci-lint doesn't.
package main
import (
"fmt"
"os"
)
func main() {
os.Setenv("test", "some_value")
fmt.Println("no lint error")
}
Please include the following information:
Config file: cat .golangci.yml
https://gist.github.com/ferhatelmas/62bbfdb744316f24a9d207c5bac0bcf7
Go environment: go version && go env
https://gist.github.com/ferhatelmas/d85e9c6dc8ce7850da37e641c87f283f
Verbose output of running: golangci-lint run -v
https://gist.github.com/ferhatelmas/4b92c91cff8456d21084494c849970f7
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Poking this issue to keep it open. I鈥檓 also having this issue
This looks like the expected behavior of exclusion EXC0001:
[~/tmp] [pts/0]% golangci-lint run --help
...
--exclude-use-default Use or not use default excludes:
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
Running with option --exclude-use-default=false shows the error on os.Setenv:
[~/tmp] [pts/0]% golangci-lint run --exclude-use-default=false main.go
main.go:9:11: Error return value of `os.Setenv` is not checked (errcheck)
os.Setenv("test", "some_value")
You can also just re-include EXC0001 in .golangci.yml:
issues:
include:
- EXC0001
It looks like errcheck itself excludes the check on fmt.Print*.
Please re-include EXC0001 for this check.
Closing for now.
Most helpful comment
This looks like the expected behavior of exclusion EXC0001:
Running with option
--exclude-use-default=falseshows the erroron os.Setenv:You can also just re-include EXC0001 in .golangci.yml:
It looks like
errcheckitself excludes the check onfmt.Print*.