Closed porridge closed 4 years ago
👍
Ran into this issue recently when upgrading, and had to revert to v0.12.8.
Did a git bisect, and it indicated: https://github.com/markbates/pkger/commit/b334bd73acb5839bc08969a0c85960ef64dca383
Lines 146 to 148 may be reverting name back to main
.
https://github.com/markbates/pkger/commit/b334bd73acb5839bc08969a0c85960ef64dca383#diff-37da6fe8e05dcc60369f46c82b2359dfR146-R148
👍
Using v0.12.7 appears to avoid this problem (thanks @fpaniagua for doing a bisect).
PRs are welcome
@markbates It would help if it was more obvious why b334bd7 does what it does. I'm quite happy to work up a fix if I know what I'm fixing :-)
Without digging in my gut is that it is meant to check if the output directory is main and set the name to that regardless.
-- Mark Bates
On Feb 14, 2020, at 6:19 PM, Alastair Houghton notifications@github.com wrote:
@markbates It would help if it was more obvious why b334bd7 does what it does. I'm quite happy to work up a fix if I know what I'm fixing :-)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Facing a similar issue here - if the root directory is a module, i.e. is not of package main
and has any *.go
files under root, pkger -include xxx
will fail (on package name conflict).
@markbates I don't think the assumption that "check if the output directory is main" is correct for the PR https://github.com/markbates/pkger/pull/53 It should be inspecting the actual output dir's current package name and set it to that, even if at top level, it's not guaranteed to be main
.
To show how painful it is for me to generate pkger.go
correctly:
*.go
's package names to main
.pkger -include xxx
.*.go
package names back to <original>
.pkger.go
's package name to <original>
.---end of rant---
I am providing a fix for both my and OP's problem here: https://github.com/markbates/pkger/pull/80 Thanks for consideration.
Thank you everyone for tracking this down and for fixing it. Release in the making.
Is this fixed? I am having this issue
Contrary to what documentation claims the
package
directive is stillmain
if I askpkger
to write the file in another directory.