make systemd and its dependencies optional via 'no_systemd' build tag (2nd take)
Hello folks,
this is my second take for making systemd stuff build-time optional. (obsoletes #2987)
It's been quite a while since the last time, and lots of things changed.
These patches first factors out systemd specific stuff in easily digestable steps, bevor adding the actual build flag. Several functions are dummies on no_systemd flag (that shouldn't be actually called) for sake of simpler code flow.
No idea how to fix the lint error - running gofumpt didn't seem to be sufficient.
Maybe the problem is the vendor dir, which isn't at all gofumpt'ed.
Overall LGTM, just a few minor issues:
- I would rename
*nosystemd.gofiles to*no_systemd.goor*systemd_stub.gofor readability; - files that end with
_linux.goshould still end with_linux.goeven when you rename/split those; - change the error messages to be less confusing and refer to systemd.
No idea how to fix the lint error - running gofumpt didn't seem to be sufficient.
The gofumpt errors in validate / lint are there because you're using old-style +build tags in the new code. Please see commit d8da00355e305f0564a9de6854bf5df1aa4b73d9 for more info on that (and if your gofumpt doesn't show/change anything, you need to update it).
- files that end with
_linux.goshould still end with_linux.goeven when you rename/split those;
I was talking about utils_linux.go file. The (better, I guess) alternative to the above is to drop the _linux part of the file name and use //go:build linux annotation instead (which I think you already do).
@opencontainers/runc-maintainers PTAL
@metux Please use git rebase main to catch up with the latest change.
@metux Please use
git rebase mainto catch up with the latest change.
done
@metux needs a rebase. Guess we can merge it right after.
@metux Are you still working on this PR? Please rebase, I think we can merge this one, and in the future release we can also provide a binary without systemd.
If @metux can no longer work on this, perhaps I can carry this one.