#Best way to make a proper (build.zig, std) Zig Project

1 messages · Page 1 of 1 (latest)

white heath
#

Hi Zig developers !

Sorry to disturbing you, again-
I had a lot of question when i work with Zig (master).

I see that Build move a lot recently, (also std)

How you manage to make your tests, should i put it at the same file where i make the struct/function on it ?
(if (this happens) how can i manage to not add test file one by one ?)

Also, Does it change anything if a do const std = @import("std") and then use it for std.mem.Allocator (only) and
doing only const Allocator = @import("std").mem.Allocator

If i had to make shared library on Zig how i should do it ?
Could i use every file/struct outside of src/root.zig (meaning without put it pub const Foo = @import("foo.zig"); each time for each type.

... another question too, if i had a chain like std.StringArrayHashMap(T) should i rename it or keep it like this for others developers ?

========

Tls 1.2 that seams not ready, of course. but there is also a update for it. but this time http proxy not works. (working with Squid)
Do you have some clues, user-agent on proxy that did that ?

========

Thx again for your reading !

vernal marlin
#
  1. Tests are typically in the same file as the struct/function to be tested, usually below all other code.
  2. No, those are identical.
  3. Declare it in build.zig using b.addSharedLibrary. And use export fn ... or @export to declare exported functions.
  4. This depends on the use case, and is mostly subjective. It's not generally right or wrong.
  5. I've used mitmproxy for this purpose before, that worked fine. I'd need more info here.
white heath