-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add config to ignore interface (#25)
* feature/ignore-interface-regex added ignoreInterfaceRegexps option to ignore errors returned from a function call defined on a interface * Added ReadMe description. Fixed comments and fixed typos * refactored regexs and globs, changed readme description, plus minor nit picks
- Loading branch information
1 parent
fab0c41
commit 624a3b4
Showing
4 changed files
with
105 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
wrapcheck/testdata/config_ignoreInterfaceRegexps/.wrapcheck.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ignoreInterfaceRegexps: | ||
- (errorer|error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"strings" | ||
) | ||
|
||
type errorer interface { | ||
Decode(v interface{}) error | ||
} | ||
|
||
func main() { | ||
d := json.NewDecoder(strings.NewReader("hello world")) | ||
do(d) | ||
} | ||
|
||
func do(fn errorer) error { | ||
var str string | ||
err := fn.Decode(&str) | ||
if err != nil { | ||
return err // errorer interface ignored as per `ignoreInterfaceRegexps` | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters