-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
pkg/ns: refactored so that builds succeed on non-linux platforms #375
pkg/ns: refactored so that builds succeed on non-linux platforms #375
Conversation
moved functions that depend on linux packages (sys/unix) into a separate file and added nop methods with a build tag for non-linux platforms in a new file.
Should ns_linux.go have a +build linux in it? |
Nah, ending a file with |
pkg/ns/ns_unspecified.go
Outdated
|
||
package ns | ||
|
||
func getCurrentThreadNetNSPath() string { |
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.
This makes me a bit uncomfortable: this is used in ns.Do()
. I know that it currently won't cause problems, but...
Could you refactor Do()
to use GetCurrentNS()
, move GetCurrentNS()
to the per-os files, and move getCurrentThreadNetNSPath
to ns_linux.go
?
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, sure. That's cleaner than how I did it.
Make GetCurrentNS platform specific instead of getCurrentThreadNetNSPath
moved functions that depend on linux packages into a separate file and added nop methods with a build tag for non-linux platforms in a new file.
Wow, I'm surprised that The code changes LGTM. If anyone wants the commits to be squashed, that'd be reasonable. |
Updates LGTM. |
Summary
moved functions that depend on linux packages (sys/unix) into a separate file
and added nop methods with a build tag for non-linux platforms in a new file.
Testing Done
./test
ran successfully, apart from themacvlan Operations
suite. I tested this on Amazon Linux and there's no support for macvlan on that platform. The failure log is pasted next: