Keep the rule, drop its second copy

This commit is contained in:
2026-09-21 22:02:28 +02:00
committed by Lillem4n
parent 3e5e01643f
commit 19274ccb2b
2 changed files with 9 additions and 15 deletions
+9 -11
View File
@@ -1077,17 +1077,15 @@ the Development section below, and who ships a register the four above then draw
- **`Column` carries text, not a Go value.** `Value` is the rendered string beside - **`Column` carries text, not a Go value.** `Value` is the rendered string beside
`DataType` and `Null`, which each serializer writes as the load check proved it; a `DataType` and `Null`, which each serializer writes as the load check proved it; a
`Value any` would hand every caller a type switch. `Value any` would hand every caller a type switch.
- **`hold` names what a render keeps, `draw` what it draws.** Goal 2 wants a name to - **`hold` names what a draw is kept in, `draw` the draw itself.** Goal 2 wants a name
reach one unit: `hold`, `holdSet` and `renderScope` are what a render holds while it to reach one unit, so a unit takes the stem of what it is, and a file the stem of the
renders, and `draw`, `drawGroup` and `drawfence.go`'s units are the draws and the units it holds.
load fence over them, so `holdfence.go` fences the hold an expansion keeps and - **A function may not spell a method; two types may.** A call writes a method with its
`drawfence.go` the reference draws `holdset.go` keeps. Valid while the load fences receiver and a function bare, so one name on both greps as one unit, which is the
sit in files of their own. reaching cost goal 2 counts, while the receiver before a shared method name says
- **A function may not spell a method; two types may.** A call writes a method with which type answers. `TestNoFunctionSpellsAMethod` holds it. A type is outside the
its receiver and a function bare, so one name on both greps as one unit, which is rule: `renderScope.hold` answers with a `*hold`, so the two spell one unit, which no
the reaching cost goal 2 counts, while the receiver before a shared method name test can judge.
says which type answers. A type is outside the rule, never being called.
`TestNoFunctionSpellsAMethod` holds it over the package, its tests included.
- **The package stays flat.** Go ties a package to one directory, so folders would - **The package stays flat.** Go ties a package to one directory, so folders would
split the API into packages. split the API into packages.
- **The performance gate asserts allocations, not wall-clock time.** `AllocsPerRun` - **The performance gate asserts allocations, not wall-clock time.** `AllocsPerRun`
-4
View File
@@ -23,8 +23,6 @@ func TestNoFunctionSpellsAMethod(t *testing.T) {
} }
} }
// namespaceFiles is every file declaring into the package namespace, its in-package
// tests included.
func namespaceFiles(t *testing.T) []*ast.File { func namespaceFiles(t *testing.T) []*ast.File {
t.Helper() t.Helper()
pkg := packageDir(t) pkg := packageDir(t)
@@ -32,8 +30,6 @@ func namespaceFiles(t *testing.T) []*ast.File {
return files return files
} }
// declaredCalls is what each name is called as: a function, and the methods
// spelling it under the types declaring them.
func declaredCalls(files []*ast.File) (funcs map[string]bool, methods map[string][]string) { func declaredCalls(files []*ast.File) (funcs map[string]bool, methods map[string][]string) {
funcs, methods = map[string]bool{}, map[string][]string{} funcs, methods = map[string]bool{}, map[string][]string{}
for _, f := range files { for _, f := range files {