From 4372b49024e82e889eb2073c37fbcc1dada05723 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 20 Apr 2026 14:16:04 +0200 Subject: feat(go): run tests --- go/build.zig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'go/build.zig') diff --git a/go/build.zig b/go/build.zig index 5e6b59d..a448636 100644 --- a/go/build.zig +++ b/go/build.zig @@ -24,8 +24,20 @@ pub fn build(b: *std.Build) !void { if (optimize != .Debug) try flags.appendSlice(b.allocator, " -s"); const go_build = b.addSystemCommand(&[_][]const u8{ "go", "build", - "-ldflags", try flags.toOwnedSlice(b.allocator), + "-ldflags", flags.items, ".", }); b.getInstallStep().dependOn(&go_build.step); + + const race = b.option(bool, "race", "Run tests with -race") orelse false; + const go_test = b.addSystemCommand(&[_][]const u8{ + "go", "test", + "-ldflags", flags.items, + "-v", + }); + if (race) go_test.addArg("-race"); + go_test.addArg("./..."); + + const test_step = b.step("test", "Run tests"); + test_step.dependOn(&go_test.step); } -- cgit v1.2.3