Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should a developer commit Go generated code?

I use a code generator plugin to generate the server stub from the OpenAPI specifications.

I want to know if I should commit the generated code to version control.

like image 637
David Avatar asked Jun 02 '19 13:06

David


1 Answers

In general, yes.

The reasoning is simple: if I'm a downstream user of your code—that is, I want to merely include your library as a dependency or build your application,—there is no point in creating additional burden on me for building your code; I should be able to merely go build/go install your code and call it a day.

If, instead, I intend to actually develop your code—either with the intent to have my changes included upstream or for maintaining these changes unpublished—it's perfectly OK to require me to regenerate certain files where it is required.

like image 100
kostix Avatar answered Oct 27 '22 11:10

kostix