Skip to content

ci: add a nightly compat matrix that verifies the declared Go floor - #550

Closed
Episkey-G wants to merge 1 commit into
masterfrom
ci/add-compat-matrix
Closed

ci: add a nightly compat matrix that verifies the declared Go floor#550
Episkey-G wants to merge 1 commit into
masterfrom
ci/add-compat-matrix

Conversation

@Episkey-G

Copy link
Copy Markdown
Collaborator

What

Adds .github/workflows/compat.yml — a scheduled compatibility matrix over Go 1.13 / 1.16 / 1.21 / 1.25.

Why

ci.yml only gates on 1.25. If generated code ever starts using a newer language or stdlib feature, the go 1.13 line in go.mod would silently stop being true and nobody would notice.

This workflow runs on schedule + workflow_dispatch only — never on pull_request or push — so it adds no checks to codegen PRs. Compatibility is a patrol result: when it goes red a human should look, but it must not participate in deciding whether a PR can merge.

The floor is measured, not copied from go.mod

Ran the whole repo in the official golang:<v> images (linux/amd64):

version go build ./... go vet ./... make ci-syntax make test-cov
1.13.15 0 0 0 0
1.16.15 0 0 0
1.21.13 0 0 0

ci-syntax includes gofmtcheck.sh, and gofmt changed doc-comment layout in 1.19 — an older gofmt could plausibly reject modern formatting and make the matrix red on day one. Checked explicitly: gofmt -l (excluding vendor) reports 0 files on all three versions.

1.16 and 1.21 are kept as intermediate points because both changed build behaviour (-mod=readonly becoming the default; toolchain auto-switching), so a future breakage can be localised.

ci.yml 只在 1.25 上跑门禁,所以生成代码哪天用上高版本才有的写法,
go.mod 里那行 `go 1.13` 会悄悄失效而没人发现。这个 workflow 专门回答那个问题。

只挂 schedule 与 workflow_dispatch,不挂 pull_request/push:兼容性是巡检结果,
红了要人来看,不该参与「这个 PR 能不能合」的判定——否则一个陈年的旧版本问题
会把日常发布卡死。codegen PR 上因此不会多出任何 check。

下界 1.13 是实测确认的,不是照抄 go.mod 声明:官方 golang 镜像跑整仓,
1.13.15 / 1.16.15 / 1.21.13 三档的 go build、go vet、make ci-syntax 全部 exit 0,
1.13 上 make test-cov 也是 exit 0。

特别验了 gofmt 的跨版本漂移——ci-syntax 里含 gofmtcheck,而 gofmt 在 1.19 改过
doc comment 排版,老版本有可能把现代格式判为不合格、让矩阵开局就红。
实测 gofmt -l(排除 vendor)在三个版本上命中数均为 0。
@sonarqubecloud

Copy link
Copy Markdown

@Episkey-G

Copy link
Copy Markdown
Collaborator Author

按仓库维护者判断撤回:兼容矩阵是纯巡检,不参与门禁判定,也没人会去盯一个非阻断的定时任务。声明的下界还成不成立是另一个问题,需要时手工跑一次即可,不必为它常驻一条每天运行的 workflow。

留档一下这次量出来的数字,省得以后有人重新做一遍。在官方 golang 镜像里跑整仓:1.13.15 / 1.16.15 / 1.21.13 三个版本的 go build ./...go vet ./...make ci-syntax 全部 exit 0,1.13 上 make test-cov 也是 exit 0。另外特意查过 gofmt 的跨版本漂移——ci-syntax 里含 gofmtcheck,而 gofmt 在 1.19 改过 doc comment 排版——gofmt -l(排除 vendor)在这三个版本上命中数都是 0。也就是说截至今天,go.mod 里那行 go 1.13 是成立的。

PR#548 的 PR 门禁不受影响,已在 master 上正常运行。

@Episkey-G Episkey-G closed this Aug 19, 2026
@Episkey-G
Episkey-G deleted the ci/add-compat-matrix branch August 19, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant