From 8f697af061e6dc73632612b59620c1539f98cfd9 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 31 Mar 2022 16:48:58 +0000 Subject: [PATCH] chore: Add comment explaining why testpackage is enabled A discussion (linked below) was had that touched on why this linter is enabled. To avoid losing that history, adding the comment inline with our linting rules can avoid duplicating this discussion! https://github.com/coder/coder/pull/741#discussion_r839026254 --- .golangci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 073fdb95ed445..c5235b204b5c7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -251,6 +251,13 @@ linters: - staticcheck - structcheck - tenv + # In Go, it's possible for a package to test it's internal functionality + # without testing any exported functions. This is enabled to promote + # decomposing a package before testing it's internals. A function caller + # should be able to test most of the functionality from exported functions. + # + # There are edge-cases to this rule, but they should be carefully considered + # to avoid structural inconsistency. - testpackage - tparallel - typecheck