Skip to content

Commit cec156e

Browse files
tannevaledclaude
andcommitted
docs: the floor is stated TWICE, and the first guard only knew about one
The README states the Go minimum in two places: line 7 [![Go](…/badge/go-1.26.4%2B-…)] line 716 Requires **Go 1.26.4+**. Both were stale against `go 1.27.1`. The first revision of this branch fixed the badge and added a guard -- and the guard swept for `go-1.x.y`, the shape I had just corrected, so it was blind to the prose one. A peer session opened #795 for the same defect and also touched only the badge. Two independent passes, one line each, and the second statement would have survived both. That is the failure worth recording: a guard written from the instance in front of me rather than from the claim being made. It could only ever have caught what I had already found. So the guard now judges the CLAIM -- every statement of a minimum -- and not the markup it wears. It also requires at least two such statements to exist, so that deleting one silently stops being a way to pass. It deliberately does NOT fail on every mention of a Go version, which is the distinction #795's body draws and is right about: a dated measurement ("measured on Go 1.26.4") would be FALSIFIED by updating it, and "Go 1.26 introduced X" is a fact about when an API appeared. Neither tracks go.mod. Only the two forms that state a minimum are matched. Those other two kinds do not currently appear in this README -- `grep` finds exactly the two lines above -- but the guard is written so that adding one later does not turn it red. Proved to fail on the prose form, not only the badge: README states a Go minimum of 1.26.4 in "Go 1.26.4+"; go.mod requires 1.27.1 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent e965ea5 commit cec156e

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ unreleased work.)
713713

714714
## Quick start
715715

716-
Requires **Go 1.26.4+**. From a checkout:
716+
Requires **Go 1.27.1+**. From a checkout:
717717

718718
```console
719719
$ go build -o rbgo ./cmd/rbgo # CGO_ENABLED=0 is the default here

‎readme_go_floor_test.go‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,28 @@ func TestReadmeGoBadgeMatchesTheModuleFloor(t *testing.T) {
4444
got, floor, floor)
4545
}
4646

47-
// A second claim in prose would drift independently of the badge, so fail on
48-
// any stale one rather than trusting that the badge is the only place.
49-
for _, stale := range regexp.MustCompile(`1\.\d+\.\d+`).FindAllString(string(readme), -1) {
50-
if strings.HasPrefix(stale, "1.2") && stale != floor && strings.Contains(string(readme), "go-"+stale) {
51-
t.Errorf("README still mentions Go %s somewhere outside the badge; go.mod requires %s", stale, floor)
47+
// The badge is not the only place the README states the floor, and a guard
48+
// scoped to the shape I happened to fix first would have missed the other
49+
// one: line 716 said "Requires **Go 1.26.4+**" and stayed stale through two
50+
// separate PRs that each corrected only the badge. So this judges the CLAIM
51+
// -- every statement of a minimum -- rather than the markup it is wearing.
52+
//
53+
// It deliberately does NOT fail on every mention of a Go version. A README
54+
// may name one for reasons that must not move: a dated measurement ("measured
55+
// on Go 1.26.4") would be falsified by updating it, and "Go 1.26 introduced X"
56+
// is a fact about when an API appeared. Only a stated MINIMUM tracks go.mod,
57+
// so only the two forms that state one are matched.
58+
minima := regexp.MustCompile(`(?:badge/go-|Go )\*{0,2}(\d+\.\d+(?:\.\d+)?)\+?\*{0,2}(?:%2B|\+)`)
59+
found := 0
60+
for _, m := range minima.FindAllStringSubmatch(string(readme), -1) {
61+
found++
62+
if m[1] != floor {
63+
t.Errorf("README states a Go minimum of %s in %q; go.mod requires %s",
64+
m[1], strings.TrimSpace(m[0]), floor)
5265
}
5366
}
67+
if found < 2 {
68+
t.Errorf("found %d statements of the Go minimum in README.md, expected at least 2 "+
69+
"(the badge and the prose requirement); if one was removed on purpose, lower this", found)
70+
}
5471
}

0 commit comments

Comments
 (0)