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 //go:generate directive to generated files #1056

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

utilyre
Copy link

@utilyre utilyre commented Jan 28, 2025

This PR adds //go:generate directive to all generated files, enabling devs to re-generate that file with the go generate command.

The aim is to make it easier and more portable (in docker containers, etc) to re-generate *_templ.go files.

Appreciate your work btw :)

@joerdav
Copy link
Collaborator

joerdav commented Feb 3, 2025

I'm not sure I fully am on board with this feature just yet. What if the command used to generate is different from the default?

If the -include-version=false flag is provided for example, a subsequent go generate would undo that.

As a heads up we do have a bit of a contribution guide here: https://github.com/a-h/templ/blob/main/CONTRIBUTING.md#come-up-with-a-design-and-share-it

Mostly so that we can talk through ideas before they are implemented:

Before starting work on any major pull requests or code changes, start a discussion at https://github.com/a-h/templ/discussions or raise an issue.

We don't want you to spend time on a PR or feature that ultimately doesn't get merged because it doesn't fit with the project goals, or the design doesn't work for some reason.

@utilyre
Copy link
Author

utilyre commented Feb 3, 2025

What if the command used to generate is different from the default?

I see, that would be an issue.

From what I've found, these are the options that can affect the output:

  • -include-version
  • -include-timestamp
  • and potentially -cmd

@joerdav, can you please confirm that this list is exhaustive?

As a heads up we do have a bit of a contribution guide here: https://github.com/a-h/templ/blob/main/CONTRIBUTING.md#come-up-with-a-design-and-share-it

Mostly so that we can talk through ideas before they are implemented:

Before starting work on any major pull requests or code changes, start a discussion at https://github.com/a-h/templ/discussions or raise an issue.

We don't want you to spend time on a PR or feature that ultimately doesn't get merged because it doesn't fit with the project goals, or the design doesn't work for some reason.

Thanks for the heads up. I didn't think this was a major PR, that's why I didn't open any issues or discussions beforehand.

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

Successfully merging this pull request may close these issues.

3 participants