Add ImportsWithSource template value
Add a template value called ImportsWithSource
. This is equivalent to the Imports
value injected into templates but is guaranteed to contain the Source
value. This is useful in cases when generating code with a --package
set to a different value than Source
because Imports
is only generated from the import statements in Source
which never contains itself. The documented suggestion of using goimports
should continue to resolve this condition for users of the Imports
template value which makes this change backwards compatible. You are encouraged to use ImportsWithSource
if you want to use the --package
flag without needing to also run goimports
.
Additionally, the Imports
and ImportsWithSource
values are now deduped which removes another reliance on goimports
.