Skip to content

Conversation

@jiacai2050
Copy link
Member

@jiacai2050 jiacai2050 commented Oct 15, 2025

@jiacai2050 jiacai2050 requested a review from Copilot October 15, 2025 12:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Bump project to Zig 0.15.2 and update examples/docs accordingly

  • Raise minimum Zig version to 0.15.2
  • Update sample code to use Reader.takeDelimiter and adjust flow; add a line-count assertion
  • Revise docs (en-US, zh-CN) to reflect API change; CI no longer pins a Zig version

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
build.zig.zon Set .minimum_zig_version to 0.15.2 to align with the new Zig toolchain.
assets/src/01-01.zig Switch to takeDelimiter, simplify error propagation with try, and add a hard-coded expectEqual on line count.
src/en-US/01-01-read-file-line-by-line.smd Update doc text to refer to takeDelimiter and remove the Reader reference link.
src/zh-CN/01-01-read-file-line-by-line.smd Chinese doc mirrors the en-US changes: takeDelimiter reference and Reader link removal.
.github/workflows/ci.yml Remove scheduled runs and unpin Zig version in setup-zig step.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

else => return err, // Propagate error
}

try std.testing.expectEqual(13, line_no);
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding the expected line count (13) couples the sample to a specific file state and introduces a magic number in main(). Consider removing this assertion, or guard it so it only runs in tests, e.g., if (@import(\"builtin\").is_test) { try std.testing.expectEqual(13, line_no); }, or move this check into a dedicated test.

Suggested change
try std.testing.expectEqual(13, line_no);
if (@import("builtin").is_test) {
try std.testing.expectEqual(13, line_no);
}

Copilot uses AI. Check for mistakes.
zig-version: [0.15.1]
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI no longer pins a Zig version, which can cause drift from .minimum_zig_version = \"0.15.2\" and lead to flaky builds when new Zig releases drop. Please pin the action to the required version, e.g., with: { version: '0.15.2' }, to keep CI reproducible and aligned with build.zig.zon.

Suggested change
- uses: mlugg/setup-zig@v2
- uses: mlugg/setup-zig@v2
with:
version: '0.15.2'

Copilot uses AI. Check for mistakes.
Comment on lines +8 to 10
There is a `Reader` type in Zig, which provides various methods to read file, such as `readAll`, `readInt`. Here we will use `takeDelimiter` to split lines.

[]($code.siteAsset('src/01-01.zig').language('zig'))
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline Reader reference previously linked to the std docs; removing the link reduces discoverability. Consider restoring an updated reference for Zig 0.15.2, e.g., add a footnote: [Reader]: https://ziglang.org/documentation/0.15.2/std/#std.io.Reader.

Suggested change
There is a `Reader` type in Zig, which provides various methods to read file, such as `readAll`, `readInt`. Here we will use `takeDelimiter` to split lines.
[]($code.siteAsset('src/01-01.zig').language('zig'))
There is a [Reader] type in Zig, which provides various methods to read file, such as `readAll`, `readInt`. Here we will use `takeDelimiter` to split lines.
[]($code.siteAsset('src/01-01.zig').language('zig'))
[`Reader`]: https://ziglang.org/documentation/0.15.2/std/#std.io.Reader

Copilot uses AI. Check for mistakes.
在 Zig 中逐行读取文件,可以使用标准库中的 [`Reader`] 类型。它提供了多种方法来读取文件内容,例如 `readAll`、`readInt` 等。这里我们将使用 `takeDelimiterExclusive` 方法来按行分割读取。
在 Zig 中逐行读取文件,可以使用标准库中的 `Reader` 类型。它提供了多种方法来读取文件内容,例如 `readAll`、`readInt` 等。这里我们将使用 `takeDelimiter` 方法来按行分割读取。

[]($code.siteAsset('src/01-01.zig').language('zig'))
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除了 Reader 的文档链接会降低可查性。建议恢复并更新到 0.15.2 的链接,例如在文末添加脚注:[Reader]: https://ziglang.org/documentation/0.15.2/std/#std.io.Reader。

Suggested change
[]($code.siteAsset('src/01-01.zig').language('zig'))
[]($code.siteAsset('src/01-01.zig').language('zig'))
[`Reader`]: https://ziglang.org/documentation/0.15.2/std/#std.io.Reader

Copilot uses AI. Check for mistakes.
@jiacai2050 jiacai2050 merged commit 50e93ab into main Oct 15, 2025
4 checks passed
@jiacai2050 jiacai2050 deleted the feat-0.15.2 branch October 15, 2025 13:00
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.

2 participants