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

Add raw code to generated file #113

Open
jmattheis opened this issue Dec 2, 2023 · 0 comments
Open

Add raw code to generated file #113

jmattheis opened this issue Dec 2, 2023 · 0 comments
Labels
feature New feature or request good first issue Good for newcomers

Comments

@jmattheis
Copy link
Owner

jmattheis commented Dec 2, 2023

Sometimes you want to add some generic code, but only after the generator ran. E.g. when you want to have a variable that has an initialized converter impl.

var Converter Converter = &ConverterImpl{}

Having this inside the conversion interface will cause compile errors. This issue proposes a new setting called goverter:output:raw where you can define raw code that will be added to the generation file.

Example:

// goverter:converter
// goverter:output:file ./output.gen.go
// goverter:output:raw func init() {
// goverter:output:raw     converter = &converterImpl{}
// goverter:output:raw }
type Converter interface {}

Please 👍 this issue if you like this functionality. If you have a specific use-case in mind, feel free to comment it.

@jmattheis jmattheis added the feature New feature or request label Dec 2, 2023
@jmattheis jmattheis added the good first issue Good for newcomers label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant