Skip to content

Commit debd9f8

Browse files
committed
fix: actualVersion() not correctly writing formatted version
1 parent 95324c9 commit debd9f8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: mlugg/setup-zig@v2
1414
with:
15-
version: "0.14.1"
15+
version: "0.15.1"
1616
- run: zig fmt --check *.zig src/*.zig
1717

1818
install-sh:
@@ -40,6 +40,6 @@ jobs:
4040
- uses: actions/checkout@v4
4141
- uses: mlugg/setup-zig@v2
4242
with:
43-
version: "0.14.1"
43+
version: "0.15.1"
4444
- run: zig build -Dtarget=${{ matrix.target }}
4545
- run: zig build test

src/common/root.zig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ pub const Release = struct {
2929
ReleaseSpec.FullVersionSpec => |v| return try alloc.dupe(u8, v),
3030
else => {
3131
if (self.actual_version == null) @panic("actual_version() called without resolving");
32-
var buffer: std.ArrayListUnmanaged(u8) = .empty;
33-
defer buffer.deinit(alloc);
34-
var writer = std.Io.Writer.Allocating.fromArrayList(alloc, &buffer);
32+
var writer = std.Io.Writer.Allocating.init(alloc);
3533
const intf = &writer.writer;
3634
try self.actual_version.?.format(intf);
37-
return try alloc.dupe(u8, buffer.items);
35+
const fmt = try writer.toOwnedSlice();
36+
return try alloc.dupe(u8, fmt);
3837
},
3938
}
4039
}

0 commit comments

Comments
 (0)