Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: cmd/go: introduce go.gen file for //go:generate comments #33375
The problem with
This kind of thing should be centralized and easy to find. I propose that
(Examples extracted from the official go generate blog post). Each line is a separated command, there's no special syntax there.
That would definitely help, but still doesn't invalidate my proposal.
That doesn't help if you're on Windows where
I think I still see value on
Note that if we change the convention, we can't get rid of the old one. We'll just have two conventions. That's typically not an improvement.
There is value in having all the go:generate lines in one place, and there is also value in having all the go:generate lines next to the things they are related to (like putting go:generate stringer lines next to the type they generate a String method for). Enforcing one is probably not right. If you want to use a gen.go, great.
We probably shouldn't force everyone, and we can't change all the existing usage even if we wanted to. I don't see how we can adopt this proposal at this point. Am I missing something?
Based on #33375 (comment), it sounds like this is a likely decline (adds a second way to do something without being able to remove the first one; increased complexity). The only comment since then, by @andreynering, was answered by @sapk.
(Also, in all seriousness, one of the first things I do on a Windows box is find a way to install a grep implementation.)
Leaving open for a week for final comments.