-
Notifications
You must be signed in to change notification settings - Fork 2.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
libcontainer: configs: ensure can build on darwin #3697
Conversation
167d603
to
a55361f
Compare
AFAICT, these CI failures aren't introduced by my change. noop PR also failing: #3698 |
/cc @AkihiroSuda, @alban @rata |
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.
It would be great if you can paste the compilation error you see (not all the lines, just the important ones if it is too verbose), so we can easily know how this fails and why this fixes it.
With the info you posted (here and in the issue) is hard to know if some changes are needed (posted those inline).
Also, why do you need this to compile on Mac? I mean, none of the cgroup stuff works there, right? Is it even a supported platform for runc?
I'm fine with the PR, but if we don't want to regress, we should probably add a test to compile on Mac, that I'm not sure what maintainers think about that.
Good call - updated the PR description
Libcontainer configs is utilized in other projects, including Kata Containers, which is adding support for building and running on Darwin.
Sure - you don't need to be on Mac. Just run "GOOS=darwin go build". |
Ohh, seems reasonable. Can you add that to the PR description and commit message?
Right, thanks! :) |
9fb5f34
to
bb6bff0
Compare
Updated the commit/PR to add more detail, and made the changes to dedup the struct based on your feedback. Thanks Rodrigo! |
bb6bff0
to
d5bb6b9
Compare
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.
LGTM, thanks!
d5bb6b9
to
d4261b6
Compare
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.
LGTM
Ups, the linter seems very unhappy about this change. Can you fix it? :) |
Ouch, this deals less with lint, and more with compilation failure. My bad. The issue is not being able to directly compose a struct that has an embedded struct (see golang/go#9859). As an example, we cannot directly initialize the embedded structs fields: m := &configs.Mount{Destination: node.Path, Source: node.Path} This results in the m := &configs.Mount{}
m.Destination = node.Path
m.Source = node.Path I don't love the making that change throughout the code - the UX in Golang for this is quite lacking. Curious to hear feedback on how you think it'd make sense to proceed here (ie, dup the struct or make changes in code base to expose the embedded struct). For me, I think just duplicating those fields, while not ideal, makes more sense. Pushing a commit to remove the embedded struct for your feedback. |
5a27166
to
512d494
Compare
configs package can no longer be built on non-Linux OS, such as Darwin. When running `GOOS=darwin go build` on the packge, we had the following errors: ``` ./configs/mount.go:34:16: undefined: unix.MountAttr ./configs/mount.go:47:22: undefined: unix.MS_BIND ``` Let's ensure that the linux specific bits are handled in mount_linux.go, and introduce a _unsupported file, similar to how cgroups file is handled within the package. This'll facilitate utilization of the pkg for other projects that care about Darwin. Signed-off-by: Eric Ernst <eric_ernst@apple.com>
512d494
to
e29e57b
Compare
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.
LGTM
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.
LGTM, thanks!
configs package can no longer be built on non-Linux OS, such as Darwin.
When running
GOOS=darwin go build
on the packge, we had the followingerrors:
Let's ensure that the linux specific bits are handled in mount_linux.go,
and introduce a _unsupported file, similar to how cgroups file is
handled within the package. This'll facilitate utilization of the pkg
for other projects that care about Darwin.
Signed-off-by: Eric Ernst eric_ernst@apple.com