-
Notifications
You must be signed in to change notification settings - Fork 769
internal: split out linux specific bits into a separate package #1540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pin and Unpin implement library-specific behaviour for BPF object pinning. Move it to package sys since that abstracts away BPF things. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Move some linux specific code out of package internal into package linux. As a rule of thumb, code probably belongs in this package if it calls into package unix. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Move Find to package linux, since it depends on deriving a file name from the current linux kernel version. This means that package kconfig only implements parsing of the kconfig format. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
The two examples call into package unix which is not available on non-Unix platforms. Add build tags so that GOOS=windows go build ./... works without errors. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
CI cross compiles the package and its tests for Darwin to make sure that it's possible to edit the source code on other Unix like platforms. Up the game a little and cross build for Windows instead of Darwin: this flushes out accidental uses of x/sys/unix instead of internal/unix. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
"github.com/go-quicktest/qt" | ||
"github.com/jsimonetti/rtnetlink/v2" | ||
"github.com/jsimonetti/rtnetlink/v2/driver" | ||
"golang.org/x/sys/unix" | ||
|
||
"github.com/cilium/ebpf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a linter that checks if imports are formatted correctly? Happy to open an issue!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this could work: https://golangci-lint.run/usage/linters/#goimports with local set to the package url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipped the issue and just opened #1541
internal: move Pin and Unpin to sys
internal: move linux specific code to separate package
internal/kconfig: move Find to package linux
examples: add linux build tag to uretprobe, ringbuf, socket_dist
program: use unix.SIGUSR1 in tests
link: use internal/unix in netkit tests
CI: cross build for Windows instead of Darwin