Skip to content

[BUG] False positive when asserting an error pointer #183

@nunnatsa

Description

@nunnatsa

Describe the bug
When asserting a pointer-error with HaveOccurred or Succeed, ginkgolinter detect the value as non error, and triggers a linter error.

To Reproduce

type myErr struct {
    code int
}

func (e *myErr) Error() string {
    ...
}

...
err = &myErr{code: 404}
Expect(err).To(HaveOccured())

Expected behavior
no linter error

Actual behavior
ginkgolinter mistakely detects err as not error type.

Environment:

  • OS: linux
  • Version v0.18.3

Additional context
Originally found here: containernetworking/cni#1148

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions