gofed / go-macros

Rpm mechanics for Go packaging
4 stars 7 forks source link

Do not install non production code by default #16

Open nim-nim opened 6 years ago

nim-nim commented 6 years ago

I see that the new code that relies on golist to list elements to install now installs test code and examples by default. And, to workaround their usual breakage, do not generate the corresponding requires

This is wrong and a bad idea on several plans:

I know a few projects import examples of other projects in their tests but this is really a marginal case and should not direct the general installation policy. And, I could workaround it via the exclusion flags, but sorting those common cases really belongs in the heart of the code analysis engine.

However, the good news is that now we started using lockfiles, it is possible to distinguish between "this package ships this go directory for tests" and "this package ships this go directory for production code" in autodeps

Therefore, I propose the following changes in golist:

And then change the shell installation logic to:

With the following autodeps logic:

That would allow splitting cleanly unit tests and examples in their own separate subpackages and have clean production-only -devel subpackages