karlseguin / http.zig

An HTTP/1.1 server for zig
MIT License
588 stars 43 forks source link

After migration error: no field named 'struct' in enum '@typeInfo #68

Closed enverbisevac closed 2 months ago

enverbisevac commented 2 months ago

I pulled latest changes and changed my code as in wiki but still I get error: no field named 'struct' in enum '@typeInfo(builtin.Type).Union.tag_type.?' .@"struct" => H, ~^~~~~ /Users/enver/zig/lib/std/builtin.zig:256:18: note: enum declared here pub const Type = union(enum) { ^~~~~ src/main.zig:4:25: note: called from here var server: httpz.Server(void) = undefined;



```
var server: httpz.Server(void) = undefined;

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer _ = gpa.deinit();

    const allocator = gpa.allocator();

    server = try httpz.Server(void).init(allocator, .{ .port = 5882 }, .{});
    defer server.deinit();

    try std.posix.sigaction(std.posix.SIG.INT, &.{ .handler = .{ .handler = shutdown }, .mask = std.posix.empty_sigset, .flags = 0 }, null);
```
karlseguin commented 2 months ago

Zig recently made a change to it's std.build.Type. You'll need the latest version of Zig.

If you're using Zig 0.13, try using the zig-0.13 branch of httpz.

enverbisevac commented 2 months ago

Thanks @karlseguin it works now, if I want latest then I need to upgrade zig too, right?

karlseguin commented 2 months ago

Yes.

The current situation is unfortunate. Exclusively track Zig master, and anyone using a fixed released is left out. Exclusively track the last release, but then anyone using master is left out. I could make changes to both master and zig-0.13, but that's more tedious for me (and, depending on the changes to Zig, it might not always be straightforward).

I'm not sure which is the best option.

enverbisevac commented 2 months ago

Thank you, I will track master maybe that is the best option for me.