-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ForceAllTypes to Options #63
Conversation
Adds a `ForceAllTypes` member to Options, forcing the generation of both the `vfsgen۰CompressedFileInfo` and `vfsgen۰FileInfo` types. Useful for other using packages that need to ensure that both types are present.
Appreciate the work you've done with this package! I am making use of this package in a different code generator that makes use of this package for binary packing of assets. For my specific use case, I am generating additional Go files (to sit in same package as code generated by This change is needed in order to correctly build a different type that also satisfies the This PR solves this by adding a |
Hi @kenshaw, Thank you for the PR and for the detailed rationale for why you want this. Added a thinking label because I'd like to take some time before making a decision here, but let me tell you my current thinking. I have some concerns about adding a feature strictly used by an external tool, since it's harder for me to maintain it and know if it breaks. However, I think your use case is reasonable and I'd like to make it possible for you to achieve it. I have an alternative idea for how we can support this and I'd like to get your thoughts on this. It's something I've been considering for a while, and I think I might be getting closer to deciding to do it. The idea is to make a change to It should solve your use case since your code could just import the same package and use its types. It would be simplify a bunch of logic around which packages need to be imported in the generate code, and make it possible to resolve issue #23 (support generating multiple variables within same package). It should be slightly more efficient in situations where multiple vfsgen-generated filesystems are used (in different packages), since the common types would be reused rather than repeated. vfsgen currently generates a single self-contained .go file without any 3rd party packages, which has nice properties. However, with Go modules happening, it should be more viable confidently rely on a fixed version of a 3rd party package, so it could be more acceptable to generate code that does that. I'm going to file a separate issue to discuss that decision in more depth, but I wanted to ask how you'd feel about it here first. Thanks! |
To be honest, it doesn't matter much either way. However, there is something nice about having a fully contained package, though. "A little copying is better than a little dependency..." |
I would suggest: it works now well on its own -- no hard requirement to refactor it. |
Have you made a decision on this? Thanks! |
I'm assuming at this point this isn't likely to be merged? |
Any further thinking done? |
Sorry about the delays. I am leaning towards not merging this PR as is because of the increased difficulty of maintenance, and I don't have the bandwidth to spend on this now. However, I do want to aim to resolve the underlying problem in a module-based v2 API (as part of resolving #23). I suggest using a fork with this |
Adds a
ForceAllTypes
member to Options, forcing the generation of boththe
vfsgen۰CompressedFileInfo
andvfsgen۰FileInfo
types. Useful forother using packages that need to ensure that both types are present.