development: keep ignored scratch experiments out of ./... package discovery #14

Closed
opened 2026-07-21 17:20:24 +02:00 by heiko · 1 comment
Owner

Problem

The repository intentionally ignores /scratch/ and excludes it from golangci-lint, but an ignored scratch/main.go under the module root is still discovered by go test ./... and staticcheck ./.... In the reviewed working tree, Staticcheck reports S1023 (redundant return) there even though golangci-lint reports zero issues.

This makes whole-module validation dependent on untracked local experiments and can produce different results for different developers.

Checklist: #2 (remove redundant/dead code) and #12 (keep experimental code outside production package discovery).

Proposed fix

Choose and document one policy:

  • keep experiments outside the module; or
  • use a directory beginning with _ or . so Go's ./... discovery ignores it; or
  • make scratch a separate nested module; or
  • track intentionally buildable examples under a real examples/ package and hold them to normal checks.

Merely adding the path to .gitignore or golangci exclusions does not affect go test ./... or standalone Staticcheck.

Acceptance criteria

  • A developer can create the documented scratch area without changing the package list for go list ./....
  • go test ./..., go vet ./..., Staticcheck, and golangci-lint inspect the same intended project packages.
  • Repository instructions explain where experiments belong.

Reviewed against 948b7a9 on master (Go 1.26.2).

## Problem The repository intentionally ignores `/scratch/` and excludes it from golangci-lint, but an ignored `scratch/main.go` under the module root is still discovered by `go test ./...` and `staticcheck ./...`. In the reviewed working tree, Staticcheck reports `S1023` (redundant return) there even though golangci-lint reports zero issues. This makes whole-module validation dependent on untracked local experiments and can produce different results for different developers. Checklist: #2 (remove redundant/dead code) and #12 (keep experimental code outside production package discovery). ## Proposed fix Choose and document one policy: - keep experiments outside the module; or - use a directory beginning with `_` or `.` so Go's `./...` discovery ignores it; or - make scratch a separate nested module; or - track intentionally buildable examples under a real `examples/` package and hold them to normal checks. Merely adding the path to `.gitignore` or golangci exclusions does not affect `go test ./...` or standalone Staticcheck. ## Acceptance criteria - A developer can create the documented scratch area without changing the package list for `go list ./...`. - `go test ./...`, `go vet ./...`, Staticcheck, and golangci-lint inspect the same intended project packages. - Repository instructions explain where experiments belong. Reviewed against `948b7a9` on `master` (Go 1.26.2).
Author
Owner

The hidden scratch policy is documented and package-discovery behavior has functional regression coverage.

Closing commit: 220883620b7b

The hidden scratch policy is documented and package-discovery behavior has functional regression coverage. Closing commit: [`220883620b7b`](https://forgejo.schlittermann.de/heiko/mail-seal/commit/220883620b7b088b1aa346fae3fbf76706baf2fc)
heiko closed this issue 2026-07-21 23:08:00 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
heiko/mailseal#14
No description provided.