You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actual behavior When generatinga mock from a source file which contains a dot import, the dot import is copied in the destination file. If the dot import is not actually used, the compiler then fails.
Expected behavior Generated code always compiles, even if someone decides to add a dot import in their code.
To Reproduce I created an example of the issue here.
Have mockgen installed.
Clone this repo or copy the following code into a main.go file:
Actual behavior When generatinga mock from a source file which contains a dot import, the dot import is copied in the destination file. If the dot import is not actually used, the compiler then fails.
Expected behavior Generated code always compiles, even if someone decides to add a dot import in their code.
To Reproduce I created an example of the issue here.
go generate ./...
go build ./...
- the compilation fails with error:mocks/main.go:13:2: "fmt" imported and not used
.Additional Information
Triage Notes for the Maintainers
Workaround
The easy and sane workaround that I will apply is just to not have dot imports. I thought it was still useful to report the bug though...
The text was updated successfully, but these errors were encountered: