csv2json
csv2json copied to clipboard
Fixed Error [Unused Capture, Unused Function Parameter and error: expected type '*std.mem.Allocator'] on Zig Version 0.9.0
Faced and Fixed the following three errors while trying to compile with zig version 0.9.0
~/ $ zig version
~/ $ 0.9.0
~/ $ cd csv2json
~/csv2json $ zig build -Drelease-fast
/home/user/csv2json/src/main.zig:66:60: error: unused capture
bufSize = std.fmt.parseUnsigned(u32, b, 10) catch |err| {
^
csv2json...The following command exited with error code 1:
/usr/bin/zig build-exe /home/user/csv2json/src/main.zig -OReleaseFast --cache-dir /home/user/csv2json/zig-cache --global-cache-dir /home/user/.cache/zig --name csv2json --pkg-begin clap /home/user/csv2json/lib/zig-clap/clap.zig --pkg-end --pkg-begin csv /home/user/csv2json/lib/zig-csv/src/main.zig --pkg-end --enable-cache
error: the following build command failed with exit code 1:
/home/user/csv2json/zig-cache/o/0cf20af84c42b68b4c79e2a929c982e5/build /usr/bin/zig /home/user/csv2json /home/user/csv2json/zig-cache /home/user/.cache/zig -Drelease-fast
src/converter.zig:166:17: error: unused function parameter
fn hasQuote(self: *Converter, val: []const u8) bool {
^
csv2json...The following command exited with error code 1:
./src/main.zig:79:45: error: expected type '*std.mem.Allocator', found '*const (bound fn(*std.heap.arena_allocator.ArenaAllocator) std.mem.Allocator)'
var conv = try Converter.init(&arena.allocator, std.io.getStdOut().writer(), bufSize);
^
./src/main.zig:79:45: note: cast discards const qualifier
var conv = try Converter.init(&arena.allocator, std.io.getStdOut().writer(), bufSize);
^
/usr/lib/zig/std/start.zig:553:40: note: referenced here
const result = root.main() catch |err| {
^
csv2json...The following command exited with error code 1: