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
cmd/go: go generate should be more resilient to source changes #36068
Here's a testscript command script that demonstrates the issue. It's a pared-down version of some real code:
When I run it, I see this:
That is, the second time that
Perhaps it should be silent in cases like this.
There may also be other cases where
One possible approach might be for
@rogpeppe, it seems very odd for
I'm assuming that you ran into this with a more realistic example somewhere. Can you give some more detail about the concrete case?
In this particular case, I was writing tests for a code generator. The generator generates code in a package, and the
The advantage of doing this is that I can check in the resulting test code, which serves as unit tests for the imported package used by the generated code. It also means that I can easily obtain coverage info for the code covered by the test cases.
There's nothing about
It still seems like the solution here belongs on the caller side: if
OTOH, if the package
I don't really see how this is so different from running
If I did that, I couldn't run the generated tests by running