-
Notifications
You must be signed in to change notification settings - Fork 49
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
osbuild: simplify code by removing osbuild.Mounts type
#373
Conversation
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.
I agree with this.
There was an idea that the abstraction might be expanded to include some useful methods that work on the Mounts
type/alias. Another idea was that it might become an interface where different stages can add their own implementations with restrictions.
None of that happened so let's clean it up. It's a low impact change and it removes ambiguities so I'm all for it.
The rebase on the merge queue seems to be causing issues. Doing a UI rebase to see what's up. |
bb8f601
to
f1dbd21
Compare
Ah, of course. The bootupd stage was merged and this PR merges cleanly but not correctly. |
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.
Needs post-rebase fixes.
The `osbuild.Mounts` type is just an alias to `[]osbuild.Mount` and it feels like it does not add clarity. From the type it's not clear if it's a slice or a map (like `osbuild.Devices`). While it is nice to abstract things away one needs to know it anyway when constructing the type so this commit removes the type and just exposes/uses `[]osbuild.Mount` directly. Another benefit of this is that the pointers used are now clearer (IMHO) - i.e. `[]Mount` is a slice so no need to indirect it further via `*Mounts` in the function signatures.
f1dbd21
to
7ee73c0
Compare
A quick drive-by commit for your consideration. I noticed while writing a test for the bootupd stage that the osbuild.Mounts type is not really helping me and hence wonder if we can do away with it. I did a grep and it seems the type is also not used outside images. Feel free to close this is you disagree or are attached to the type but to me the code feels easier to work with without it (and if you agree with this change I would like to see if
osbuild.Device
might also benefit from this).The
osbuild.Mounts
type is just an alias to[]osbuild.Mount
and it feels like it does not add clarity. From the type it's not clear if it's a slice or a map (likeosbuild.Devices
). While it is nice to abstract things away one needs to know it anyway when constructing the type so this commit removes the type and just exposes/uses[]osbuild.Mount
directly.Another benefit of this is that the pointers used are now clearer (IMHO) - i.e.
[]Mount
is a slice so no need to indirect it further via*Mounts
in the function signatures.