Test-only package internal/livedns can be compiled into the binary: rename it and name it in the test-support lint rule #164

Open
opened 2026-09-29 09:10:45 +02:00 by clawbot · 0 comments
Collaborator

internal/livedns (added under #159) holds the retry and the limit on concurrent lookups that tests use against live DNS. Only tests import it, and it imports testing, but nothing stops program code from importing it and compiling it into the shipped binary.

The org .golangci.yml (re-vendored under #123) has a depguard rule, test-support, for exactly this: files in a package whose directory name ends in test are exempt, and each repository names its own test-support packages in that rule's deny list by full import path. The file's own comment says the deny list is the one part a repository is expected to extend.

Definition of done

  • The package is renamed internal/livednstest, and every import and mention is updated (README Architecture, TESTING.md, comments, TODO.md).
  • sneak.berlin/go/dnswatcher/internal/livednstest is added to the test-support deny list in .golangci.yml, with a one-line desc in the style of the existing entry. Nothing else in .golangci.yml changes.
  • Shown by experiment: importing the package from a non-test file makes make lint fail; revert.
  • No DNS stand-ins. make check green.

Model: opus-5-5

`internal/livedns` (added under https://git.eeqj.de/sneak/dnswatcher/issues/159) holds the retry and the limit on concurrent lookups that tests use against live DNS. Only tests import it, and it imports `testing`, but nothing stops program code from importing it and compiling it into the shipped binary. The org `.golangci.yml` (re-vendored under https://git.eeqj.de/sneak/dnswatcher/issues/123) has a `depguard` rule, `test-support`, for exactly this: files in a package whose directory name ends in `test` are exempt, and each repository names its own test-support packages in that rule's `deny` list by full import path. The file's own comment says the `deny` list is the one part a repository is expected to extend. ## Definition of done - The package is renamed `internal/livednstest`, and every import and mention is updated (README Architecture, `TESTING.md`, comments, `TODO.md`). - `sneak.berlin/go/dnswatcher/internal/livednstest` is added to the `test-support` `deny` list in `.golangci.yml`, with a one-line `desc` in the style of the existing entry. Nothing else in `.golangci.yml` changes. - Shown by experiment: importing the package from a non-test file makes `make lint` fail; revert. - No DNS stand-ins. `make check` green. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/dnswatcher#164