Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
os/user: query systemd’s User/Group Record Lookup API in non-cgo environments before parsing /etc/passwd? #38810
I recently learnt about systemd’s “User/Group Record Lookup API via Varlink”.
It’s a new service introduced by systemd v245 (released March 6th 2020) which can take the role of getpwnam(3) and related calls.
We could consider this as an option for
There are two possible ways to query the service:
While related, that’s a much different call IMO: here, we implement 1 reasonably small API and get access to all NSS plugins.
I’m not saying they do.
I’m saying that when disabling cgo for whichever reason, there is a feature disparity in
It certainly could. The downside of course is that users then first need to discover that package. I think that instead of having each programmer find out about the
That's a pretty compelling argument, actually.
As for whether we use os/exec: I don't feel strongly either way. Both options involve encoding/json, and the do-it-ourselves way doesn't look super invasive. I'd say do it ourselves if that meant running in more environments or if it was a hot path, but I can't imagine any environment that wouldn't have