Skip to content
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

Feature proposal: Generate jennifer code from existing go code #54

Open
aloder opened this issue Jan 27, 2019 · 9 comments
Open

Feature proposal: Generate jennifer code from existing go code #54

aloder opened this issue Jan 27, 2019 · 9 comments

Comments

@aloder
Copy link

aloder commented Jan 27, 2019

I wanted to take an existing file like the one in #50 and convert it so that jennifer generates it. Right now I am doing this by hand. I would like a function that takes in a go file and outputs the code that generates that go file using jennifer.

This would discourage workarounds like Op and allow quick generation of static files.

Similar to #44
Solves #50

@dave
Copy link
Owner

dave commented Jan 27, 2019

This would be great, but more appropriate as a standalone utility - e.g. not integrated into the jennifer codebase. Similar to my html2vecty utility for doing the same thing with vecty syntax. I definitely won't have time to do this in the next 6 months so feel free to have a go. I'll happily include a link in the readme when it's finished.

@aloder
Copy link
Author

aloder commented Jan 27, 2019

I agree, I'll look into making it but I have little experience with ASTs.

The more I think about it the more appealing a tool like this becomes. You can use this tool as a starting point for generating code, filling in the logic and the variables after. Eliminating most of the monotony of writing generated code.

@dave
Copy link
Owner

dave commented Jan 27, 2019

Yes it would be useful. Feel free to fork html2vecty and use that as a base...

@aloder
Copy link
Author

aloder commented Feb 13, 2019

Alright just got the project up to a usable standard: https://github.com/aloder/jenjen

Let me know what you think.

@dave
Copy link
Owner

dave commented Feb 13, 2019

Wow this looks great! Won't have time to look at it today or tomorrow but Friday I can have a good play.

@dave
Copy link
Owner

dave commented Feb 13, 2019

p.s. Are you set on the jenjen name? The jennifer project has a genjen package that generates the API... might be rather confusing...

@aloder
Copy link
Author

aloder commented Feb 13, 2019

Yea, I noticed that right after I pushed the name. I can change it. I'll start thinking of others.

@dave
Copy link
Owner

dave commented Feb 13, 2019

Awesome. I took a very quick look at the code and it looks great!

@aloder
Copy link
Author

aloder commented Feb 13, 2019

Thank you, I will be improving the code and features as I use it in my own products.

Let me know if you have any suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants