-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error variables are variables starting with 'err' or 'Err'. This implements #2.
- Loading branch information
1 parent
9d4b45f
commit 4886830
Showing
3 changed files
with
74 additions
and
3 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
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
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,34 @@ | ||
package code | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
// Those are not errors | ||
var myVar = 1 | ||
|
||
// Those are fake errors which are currently not detected | ||
// because they start with 'err' or 'Err' and we don't | ||
// check if such a variable implements the error interface. | ||
var errFakeErrorUnexported = 1 | ||
var ErrFakeErrorExported = 1 | ||
|
||
// Those errors are not named correctly | ||
var myErrVar = errors.New("myErrVar") | ||
var myVarErr = errors.New("myVarErr") | ||
var myVarError = errors.New("myVarErr") | ||
var customErr = customError{"customErr"} | ||
|
||
// Those are actual errors which should be ignored | ||
var errUnexported = errors.New("errUnexported") | ||
var ErrExported = errors.New("ErrExported") | ||
var errCustomUnexported = customError{"errCustomUnexported"} | ||
var ErrCustomExported = customError{"ErrCustomExported"} | ||
|
||
// Those actual errors have a declared error type | ||
var declaredErr error = errors.New("declaredErr") | ||
var errDeclared error = errors.New("errDeclared") | ||
|
||
type customError struct{ e string } | ||
|
||
func (e *customError) Error() string { return e.e } |