Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

handle failed expectations in non-main goroutine #145

@jmhodges

Description

@jmhodges

I use gomock to hide the details of third party services I don't control. The code that calls those services are often off the main goroutine.

Because of that, when tests fail due to expectation failures, gomock will emit a data race because it calls Fatalf (which calls FailNow) immediately off the main thread. That's, of course, not allowed by the testing package. https://golang.org/pkg/testing/#T.FailNow

I'm having to build out my own stubs in order to get around this problem. It'd be nice to not to!

This would probably require gomock panicing instead of relying on Fatalf to panic for it and delaying the Fatalf calls until ctrl.Finish is called.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions