Skip to content

Commit 3c2aa58

Browse files
authored
Add *println to exception EXC0001 (#1074)
Exception EXC0001 ignores errors on functions like Sprint and Sprintf, but not Sprintln. Update the exception to include *println as well.
1 parent cb58d1f commit 3c2aa58

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ Flags:
555555
-e, --exclude strings Exclude issue by regexp
556556
--exclude-use-default Use or not use default excludes:
557557
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
558-
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
558+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
559559
560560
# EXC0002 golint: Annoying issue about not having a comment. The rare codebase has such comments
561561
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)

pkg/config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var DefaultExcludePatterns = []ExcludePattern{
4040
{
4141
ID: "EXC0001",
4242
Pattern: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close" +
43-
"|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked",
43+
"|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked",
4444
Linter: "errcheck",
4545
Why: "Almost all programs ignore errors on these functions and in most cases it's ok",
4646
},
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
linters-settings:
22
errcheck:
33
check-blank: true
4-
ignore: os:.*,io/ioutil:^ReadF.*
4+
ignore: os:.*,io/ioutil:^ReadF.*
5+
issues:
6+
include:
7+
- EXC0001

0 commit comments

Comments
 (0)