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

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Jun 19 15:34:00 PDT 2014


On Thu, Jun 19, 2014 at 12:28:06PM -0700, Brandon Philips wrote:
> 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
Probably not. There's no need to load an extra library.

> > 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.

> Maybe it is some random bug with Go 1.2? Go 1.3 is out now.
That's possible. If the basic journal sender apis were buggy, we'd
most likely see numerous reports.

Zbyszek


More information about the systemd-devel mailing list