-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix: false positive for func returns error func
The linter triggers a warning for this case: ```go func errFunc() func() error { return func() error { return errors.New("error") } } var _ = Describe("test if issue 174 was solved", func() { It("should not trigger", func() { Eventually(errFunc()).Should(MatchError(ContainSubstring("error"))) }) }) ``` The linter fails to identify the actual value as error value.
- Loading branch information
Showing
3 changed files
with
32 additions
and
6 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,20 @@ | ||
package issue_171 | ||
|
||
import ( | ||
"errors" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func errFunc() func() error { | ||
return func() error { | ||
return errors.New("error") | ||
} | ||
} | ||
|
||
var _ = Describe("test if issue 174 was solved", func() { | ||
It("should not trigger", func() { | ||
Eventually(errFunc()).Should(MatchError(ContainSubstring("error"))) | ||
}) | ||
}) |