Skip to content

Commit

Permalink
Add *println to exception EXC0001 (#1074)
Browse files Browse the repository at this point in the history
Exception EXC0001 ignores errors on functions like Sprint and Sprintf,
but not Sprintln. Update the exception to include *println as well.
  • Loading branch information
cjkreklow committed May 9, 2020
1 parent cb58d1f commit 3c2aa58
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ Flags:
-e, --exclude strings Exclude issue by regexp
--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
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# EXC0002 golint: Annoying issue about not having a comment. The rare codebase has such comments
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var DefaultExcludePatterns = []ExcludePattern{
{
ID: "EXC0001",
Pattern: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close" +
"|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked",
"|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked",
Linter: "errcheck",
Why: "Almost all programs ignore errors on these functions and in most cases it's ok",
},
Expand Down
5 changes: 4 additions & 1 deletion test/testdata/errcheck/ignore_config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
linters-settings:
errcheck:
check-blank: true
ignore: os:.*,io/ioutil:^ReadF.*
ignore: os:.*,io/ioutil:^ReadF.*
issues:
include:
- EXC0001

0 comments on commit 3c2aa58

Please sign in to comment.