proud-dentist-2284402/12/2023, 7:06 PM
goal in a 2.15 release notes PR. Thinking about differences between other pants codegen and this: I think pants codegen is designed for generated code that is NOT version controlled. But the product of
(and the underlying
statements) are expected to be committed in git (or similar version control). Is that an accurate comparison? Second question: Would a lint step be helpful for the go-generated code such that lint fails if go-generate would update the generated files?
fast-nail-5540002/12/2023, 8:09 PM
But the product ofYes. Which is how users using(and the underlying
go-generatestatements) are expected to be committed in git (or similar version control). Is that an accurate comparison?
and not Pants would expect
Go generate does nothing that couldn’t be done with Make or some other build mechanism, but it comes with the(bold added by me)tool—no extra installation required—and fits nicely into the Go ecosystem. Just keep in mind that it is for package authors, not clients, if only for the reason that the program it invokes might not be available on the target machine. Also, if the containing package is intended for import by
go, once the file is generated (and tested!) it must be checked into the source code repository to be available to clients.
Second question: Would a lint step be helpful for the go-generated code such that lint fails if go-generate would update the generated files?Maybe but it would be a feature that
itself does not offer, so I would not expect users familiar with
to expect Pants to offer that. So I don't see a great need to add such a feature.
proud-dentist-2284402/12/2023, 11:31 PM
then those files need a BUILD target that owns them, right? So you'd end up running sometime like
. In other words, pants has no idea that a given file was created via
fast-nail-5540002/14/2023, 8:10 AM
In other words, pants has no idea that a given file was created viaCorrect. I will add if there is a.
already and if the
invoked program writes
files, then the
will automatically see the sources. The intention with
was to match the
experience as exactly as possible.