Repository navigation
chore: zig fmt the tracked Zig sources - #656
Merged
Merged
Conversation
`zig fmt --check` reported nine tracked files out of conformance. This runs
zig fmt over them, changing nothing else.
Scope
build.zig
sandboxd/src/events.zig, transcript.zig, files.zig, execctl.zig,
watch.zig, processes.zig, transcript_test.zig
tandem/src/storage/rqlite.zig
One reported path is deliberately left alone:
tandem/zig-pkg/libxev-*/src/bench/ping-pongs.zig sits inside the fetched
dependency cache (gitignored via /tandem/zig-pkg), so it is neither tracked nor
ours to reformat.
Verification
Every file is whitespace-only at the token level: stripping all spaces, tabs
and newlines from the old and new content yields identical bytes, per file. So
no expression, string or operator moved.
- zig build sandboxd -> all three musl targets build
- zig fmt --check -> clean for build.zig and sandboxd/src/*.zig
- sandboxd unit tests -> the same 12 pre-existing failures before and after,
identical by name (PTY tests plus a readAllFromFdTrunc 1 MiB off-by-one,
both unrelated to formatting and all Linux-side)
Needed because an earlier change to build.zig (making static linking
Linux-only) would otherwise ship with an unformatted build.zig; a clean tree
also keeps the next real edit reviewable.
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



纯格式化 PR:对
main上被zig fmt --check报出来的 9 个已跟踪 Zig 文件跑一遍zig fmt,不改任何其他东西。范围
共 9 个文件、22 增 43 删,体量很小,便于 review。
有一个被报出来的文件故意不动:
tandem/zig-pkg/libxev-*/src/bench/ping-pongs.zig位于依赖缓存目录里(.gitignore的/tandem/zig-pkg已排除),既未被 git 跟踪,也不属于我们该改的第三方代码。如何证明「只动了空白」
git diff -w在这里不能作为证据——zig fmt重排了换行(比如把三行的inotify_add_watch(...)合成一行),行内容变了但 token 没变。所以我对每个文件做了 token 级比对:把改动前后的内容去掉所有空格、tab、换行后逐字节比较。
9/9 完全一致 → 没有任何表达式、字符串字面量或运算符发生变化。
验证
zig build sandboxdzig fmt --check build.zig sandboxd/src/*.zig那 12 个失败是既有的(PTY 测试 +
readAllFromFdTrunc的 1 MiB 越界,都是 Linux 侧、与格式化无关),与格式化无关,未在本次范围内处理。为什么现在做
配合 #655:那个 PR 改了
build.zig(把静态链接限制为 Linux-only),如果不先格式化,build.zig就会带着不合规状态进去。保持树干净,下一个真正的改动也好 review。需要说明的是两个 PR 都动
build.zig:本 PR 是纯对齐调整,#655 是在buildVersionFlags里加参数。改动区域不同,rebase 时 git 应能自动解决;如果冲突我会先 rebase 本 PR。