> Mostly trying to improve the UX by avoiding generated code clutter during development. I concede that storing all your generated code in one directory inside your project isn't that big of a deal. Another solution could be to configure your editor to hide the generated directory.
Either that or, assuming you have some sort of visual tree view, to
show generated files in italics or some such. Or to have generated
files not be included in fuzzy finder results. There are many
> Yah, exactly. The CLI wraps "go run" anyway, so there's a place to generate code on new machines before starting the program.
So this is a tool you are writing for other developers? I'm further
assuming the generated code is critical to code they are then writing.
If so, this surely must be committed with whatever code they are
writing? In which case, generating this to anywhere other than the
place where they are writing code is a problem. But then I might have
totally misunderstood what you are doing here, in which case can you
explain a bit more?
> > In which case replace directives with a directory target is most likely your best solution:
> Replace is an interesting idea. I think replace would work well if there was a standard place to put generated code outside of your project. I guess that's what I'm looking for: a standard place to hide away generated code until you care about it and want to vendor it. And when you do want to vendor it, you can use the same code paths as your third-party dependencies.
There is nothing stopping you coming up with your own convention here,
or indeed retaining the convention of using
etc. Tools like gohack
) do just that: establish a