-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Component(s)
cmd/mdatagen
Describe the issue you're reporting
I'm filing this issue as a result of open-telemetry/opentelemetry-collector-contrib#45013
Currently, after generating files using mdatagen, the generated go code must be formatted and the import order must be overwritten (in contrib this means running make generate, make fmt, and make gci.) This solution works, but it means users may forget to run the formatting and gci commands, resulting in improperly formatted go code, or more steps to getting CI/CD green on a PR.
That being said, to handle this in mdatagen could make import logic considerably more complicated, since all imports would need to be known, and blank lines could only be added if a block has imports, etc. I'll defer to code owners to decide if this enhancement is worth the effort, or if we should stick with requiring make fmt and make gci to be run every time after mdatagen.
An alternative solution may just be to somehow built in the make fmt and make gci calls to the mdatagen functionality, but that may also just be another level of complexity.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.