[systemd-devel] Soliciting feedback for golang bindings to the systemd journal C API

Brandon Philips brandon at ifup.co
Thu Jun 19 12:28:06 PDT 2014


On Sat, Jun 14, 2014 at 8:13 AM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> I think that designing the api in steps like this will make it harder
> to get a consistent design. The journal api is rather small, so I don't
> think it is hard to cover most of it in the initial design. In my
> experience, getting sd_journal_print, sd_journal_send, sd_journal_sendv
> wrappers consistent requires some care.

I agree, I would rather do this all at once.

> About the proposed go api:
>
> I think the reader and writer apis should be totally separate.
> Different files/modules/whatever. They don't share implementation,
> and usually are not used together.

Yes, I agree. Actually, is there a reason to bind to the C
sd_journal_print if we already have a pure Go version of
sd_journal_send?
https://github.com/coreos/go-systemd/blob/master/journal/send.go

> In some places in the go code '%s' is used with numerical 'err'.
> Does this work at all?

Yes it works, Go's print is typesafe but it will look strange:
%!s(int=42). We should probably turn them into syscall.Errno() type.

> It's hard to say with the scant backtrace. But I don't recall
> ever seeing any crashes related to sd_journal_wait.

Dan, how do you want me to help out with this? I am happy to dig in if
you want to share a branch or something. Or you can send a PR and we
can start from there.

Brandon

[1] http://play.golang.org/p/zTOuMj-sg7
[2] http://play.golang.org/p/NDnJF8Zocf


More information about the systemd-devel mailing list