Closed dterei closed 5 years ago
@alvaroloes ping?
I have merged this in my new and supported version that is a drop in replacement. A long with go mod
support. If your interested.
https://github.com/dmarkham/enumer
Sorry for my looooong time missing. I was completely immersed in other stuff. I love this PR. Thank you very much!
@alvaroloes welcome back. With this merge there was a small edge case bug that was reported and fixed. Please consider this patch. Rename does not work so well across file systems so making the temporary file far away form the final place was failing for some.
Few improvements needed by our use of stringer:
Add support for including comments. We use this to mark the code as generated code on review tools like phabricator (
enumer -type Day -comment @ -comment generated
). The multi-flag support is needed so that the@generated
tag can be split up as otherwise phabricator thinks the file calling enumber (using go generate) is generated code. Yes, dumb, but the limits of phabricator sadly.Write to a temporary file first then rename to ensure atomic operations. This prevents any issues that occur if building and generation overlap with parallel builds. E.g., we checkin the generated code to
git
which is common, but also generate the code again when building, which should be a noop, but can cause issues if we try to parallelize things as building may see a partial file state.