Skip to content

Conversation

jiacai2050
Copy link
Member

Close #112

fix up to 04-03
@jiacai2050 jiacai2050 marked this pull request as ready for review September 27, 2025 13:06
@jiacai2050
Copy link
Member Author

/gemini review

Copy link
Contributor

@Copilot 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

This PR updates the Zig Cookbook to be compatible with Zig version 0.15. The changes include updating API calls, method names, and build configurations to match the new version's requirements.

  • Update Zig version from 0.14.x to 0.15.x across the codebase
  • Replace deprecated API methods with their Zig 0.15 equivalents
  • Update build system configurations for the new version

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
README.md Updates version tracking information to Zig 0.15.x
.github/workflows/ci.yml Bumps CI Zig version from 0.14.1 to 0.15.1
build.zig.zon Updates zigcli dependency from v0.2.3 to v0.3.0
build.zig Updates build system API calls for Zig 0.15 compatibility
src/*/01-01-read-file-line-by-line.smd Updates documentation to reflect API method name change
assets/src/*.zig Updates various source files with new API methods and patterns

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

defer server.deinit();

log.info("Start HTTP server at {any}", .{addr});
log.info("Start HTTP server at {f}", .{addr});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but addr is a network address. This should be {any} to properly format the address.

Suggested change
log.info("Start HTTP server at {f}", .{addr});
log.info("Start HTTP server at {any}", .{addr});

Copilot uses AI. Check for mistakes.

defer conn.stream.close();

log.info("Got new client({any})!", .{conn.address});
log.info("Got new client({f})!", .{conn.address});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but conn.address is a network address. This should be {any} to properly format the address.

Suggested change
log.info("Got new client({f})!", .{conn.address});
log.info("Got new client({any})!", .{conn.address});

Copilot uses AI. Check for mistakes.

var buf: [1024]u8 = undefined;

print("Listen on {any}...\n", .{addr});
print("Listen on {f}\n", .{addr});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but addr is a network address. This should be {any} to properly format the address.

Suggested change
print("Listen on {f}\n", .{addr});
print("Listen on {any}\n", .{addr});

Copilot uses AI. Check for mistakes.

const stream = try net.tcpConnectToAddress(peer);
defer stream.close();
print("Connecting to {}\n", .{peer});
print("Connecting to {f}\n", .{peer});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but peer is a network address. This should be {any} to properly format the address.

Suggested change
print("Connecting to {f}\n", .{peer});
print("Connecting to {any}\n", .{peer});

Copilot uses AI. Check for mistakes.


print("{} says {s}\n", .{ client.address, message });
fn handleClient(client: net.Server.Connection) !void {
print("Accepted connection from {f}\n", .{client.address});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but client.address is a network address. This should be {any} to properly format the address.

Copilot uses AI. Check for mistakes.

var writer = client.stream.writer(&.{});

while (true) {
print("Waiting for data from {f}...\n", .{client.address});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but client.address is a network address. This should be {any} to properly format the address.

Copilot uses AI. Check for mistakes.

print("Waiting for data from {f}...\n", .{client.address});
const msg = reader.interface().takeDelimiterInclusive('\n') catch |err| {
if (err == error.EndOfStream) {
print("{f} closed the connection\n", .{client.address});
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but client.address is a network address. This should be {any} to properly format the address.

Suggested change
print("{f} closed the connection\n", .{client.address});
print("{any} closed the connection\n", .{client.address});

Copilot uses AI. Check for mistakes.

return err;
}
};
print("{f} says {s}", .{ client.address, msg });
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The format specifier {f} is for floating point numbers, but client.address is a network address. This should be {any} to properly format the address.

Copilot uses AI. Check for mistakes.

@jiacai2050 jiacai2050 merged commit bfedfd1 into main Sep 27, 2025
4 checks passed
@jiacai2050 jiacai2050 deleted the feat-0.15 branch September 27, 2025 13:17
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.

Adopt with Zig 0.15.1

1 participant