Commit 52a3ba5
committed
Don't allow
This one's aimed at producing a more permanent structural fix for #1342
by keeping an eye out for the same problematic condition using the
depguard lint. As a summary of the problem corrected by #1342:
* We use the `testsignal` package in all kinds of non-test code, so
packages including River always build against it.
* `testsignal` was importing `riversharedtest`, which imports Testify,
Goleak, YAML (through Testify).
* This was causing all packages built against River to pick up an extra
~10 kB worth of dependencies in their production builds, which is bad.
Here, add some new rules for depguard:
* Don't allow test packages like Goleak or Testify to be imported by any
non-test Go files. We make an exception for internal test support
packages like `riverdbtest` and `riverdrivertest`.
* Don't allow `testsignal` to have any dependencies beyond stdlib and
`testutil`.
* Don't allow `testutil` to have any non-stdlib dependencies. This rule
is so that `testsignal` doesn't pick up unexpected dependencies
transitively through `testutil`.testsignal to pick up non-stdlib dependencies1 parent 60435dc commit 52a3ba5
1 file changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
55 | 77 | | |
56 | 78 | | |
57 | 79 | | |
| |||
0 commit comments