Open pierznj opened 7 years ago
We are seeing similar behaviour with the packages errors
and github.com/pkg/errors
.
Are there any means to make sure the imports stay the same?
I guess that it's using goimports or some such and there is ambiguity between two packages on your system, e.g. errors
and github.com/pkg/errors
so it does nothing in that case. It would be better if it just copies the imports verbatim and removes the import to genny (if unused).
In my template I have these imports:
My generated files have imports looking like this:
You can see that "errors" has been removed (thus preventing my code from compiling), and "github.com/macropodhq/go.uuid" has been renamed to "uuid" (I didn't ask for it, but OK). Furthermore it has decided to replace the custom json package we use with the standard "Go encoding/json" package. I guess genny is auto-fixing the imports section - but it's doing it wrongly.