[Breaking] Fix issue where we have duplicate packages in tests#301
[Breaking] Fix issue where we have duplicate packages in tests#301Tatskaari wants to merge 3 commits intoplease-build:masterfrom
Conversation
d2d0cb1 to
c5af7be
Compare
|
Why is this breaking? Is it just because it stops this behaviour of registering things twice? |
Yeah, there are a number of places in core3 where a test package imports itself. This is fine right now because the test vs. prod packages are different. Going forward this will be a cyclic import. |
Right, thanks. I think those are degenerate and they shouldn't have been doing that (albeit it was allowed and so eventually someone will try to do that thing). I don't think that would have worked with |
When we build tests that aren't external, we have two versions for the package under test:
go_library()target that we're trying to test_{name}#libpackage that re-compiles that package with all the test sourcesBefore we would have two different import paths for these two versions of the package. They're both available in the test binary, where the test version of the package is available as
import "{name}_test_lib".This causes a bunch of problems and confusion:
There are a few cases internally where a non-exported test imports the non-test version of the package to avoid type conflicts between the two versions of the packages.
This PR links the test version of the package into the binary, with the same import path as the prod version. This means there's no distinction.
TODO gate this behind a feature flag.