Skip to content

Import cycle is not allowed in test #262

@ikolomiyets

Description

@ikolomiyets

I have encountered the issue which I believe was reported and discussed numerous times. The problem occurs when interface that is getting mocked is residing in the same package where it is getting used. Fake implementations are generated perfectly but when I am trying to run the tests I am getting the following error:

	imports github.com/ikolomiyets/test-project/internal/controllers/controllersfakes
	imports github.com/ikolomiyets/test-project/internal/controllers: import cycle not allowed in test

It would be great to have a separate mode for this kind of mocks, so the fake implementations are generated into the same package into the file with _test.go suffix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions