Declare a target as unsupported in build.zig

I’ve had a similar issue when trying to run scoop’s doc and fmt steps on Linux CI/CD runners.

I solved it by returning either a public Darwin or a private Linux module from an if/else block:

If you’d still like to let Linux users know that their OS isn’t supported you can std.log.err your message.

In general, when it comes to handling failing cases you shouldn’t reach for errors, but rather consider using either b.addFail, std.log.err, or @panic/std.debug.panic.

UPD: I’ve added failing case handling to the Doc:

2 Likes