-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ginkgolinter: false positive with Eventually(func(g Gomega){}) #5398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
We are seeing the same failure with our codebase: https://github.com/cloudfoundry/korifi/tree/55b4d9219d221491330a9292ed6f31cc152bb89f We have seen no issues with the same code with golangci-lint 1.63.4. As @Luap99 observed, just running the ginkgo linter succeeds. |
This is valid and the upstream linter allows it but somehow with golangci-lint it produces an error: Success matcher only support a single error value, or function with Gomega as its first parameter I reported a bug upstream[1] but for now let's just ignore it so we can update the linter. [1] golangci/golangci-lint#5398 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
golangci-lint 1.64.2 reports false positives with the ginkgolinter, see golangci/golangci-lint#5398 Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
I'm investigating but I observed that modifying the function signature seems to "fix" the problem package main_test
import (
"testing"
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestBooks(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "t")
}
var _ = Describe("t", func() {
It("t", func() {
Eventually(func(g Gomega) error {
g.Expect("abc").To(Equal("abc"))
return nil
}).WithTimeout(time.Second).Should(Succeed())
})
}) |
golangci-lint 1.64.2 reports false positives with the ginkgolinter, see golangci/golangci-lint#5398 Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
This is ginkgolinter problem: if I modify the min go version of ginkgolinter to go1.23.0 I have the same behavior: $ ginkgolinter ./...
/home/ldez/sources/golangci/sandbox/foo_test.go:19:3: ginkgo-linter: Success matcher only support a single error value, or function with Gomega as its first parameter ping @nunnatsa |
Thanks you all! I noticed the same issue. It doesn't happen when running ginkgolinter cli directly, or with the previous version of golangci-lint, even though the ginkgolinter version was not changed. @ldez - not sure what you mean by |
OK, I locally bumped golang in ginkgolinter to 1.23 - and I can see the error in my tests. looking |
Just released ginkgolinter v0.19.0 with a fix to this issue: https://github.com/nunnatsa/ginkgolinter/releases/tag/v0.19.0 |
Fixed by #5404 But I think the fix can have side effects, so I opened a complementary PR nunnatsa/ginkgolinter#187. |
The [issue](golangci/golangci-lint#5398) with false positives from the ginkgolinter has been resolved This reverts commit cd5f925.
The [issue](golangci/golangci-lint#5398) with false positives from the ginkgolinter has been resolved This reverts commit cd5f925. fixes #3794
The [issue](golangci/golangci-lint#5398) with false positives from the ginkgolinter has been resolved This reverts commit cd5f925. fixes #3794
This reverts commit 8b6f14f. golangci/golangci-lint#5398 is fixed Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This is valid and the upstream linter allows it but somehow with golangci-lint it produces an error: Success matcher only support a single error value, or function with Gomega as its first parameter I reported a bug upstream[1] but for now let's just ignore it so we can update the linter. [1] golangci/golangci-lint#5398 Signed-off-by: Paul Holzinger <pholzing@redhat.com> (cherry picked from commit 8b6f14f) Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit 8b6f14f. golangci/golangci-lint#5398 is fixed Signed-off-by: Paul Holzinger <pholzing@redhat.com> (cherry picked from commit 7773713) Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Welcome
typecheck
section of the FAQ.Description of the problem
After the update to v1.64.2 I See false positives from the ginkgolinter about something like this
per ginkgo docs this is valid and looking at ginkgolinter upstream this should be allowed
https://github.com/nunnatsa/ginkgolinter?tab=readme-ov-file#prevent-wrong-actual-values-with-the-succeed-matcher-bug
Running ginkgolinter directly with
ginkgolinter ./...
does not produce this error so I think this is something with the golangci-lint integration here that is triggering the issue.Version of golangci-lint
Configuration
$ golangci-lint run -E ginkgolinter
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
Validation
Supporter
The text was updated successfully, but these errors were encountered: