-
Notifications
You must be signed in to change notification settings - Fork 247
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
rbd: image Open function is non-idiomatic Go #105
Comments
I'm agreed about your opinion, I'm confused about I think there are some options for idiomatic Go
|
I've started working on this. PR coming soon(ish). |
Anyone interested in this topic please look at #146 and provide feedback. We intend to change the typical workflow such that new open functions return the rbd Image type and Create functions only return an error (like the ceph apis). |
The rbd module's Image.Open function is rather non-idiomatic for Go code. It accepts any number of
interface{}
arguments and then loops on them checking (only!) the type and uses those to select which ceph api function to run.This means that
x.Open("foo", true)
andx.Open(true, "foo")
are equivalent, as well asx.Open("foo", "foo", false, "bar", true, false, "foo", true)
. I've never seen go code like that! :-)I'm not sure if this function wanted to mimic the style of the python api or what but it strikes me as odd.
It would be preferable to create more idiomatic approaches to Image type and the rbd open functions and then deprecate this approach to Open.
The text was updated successfully, but these errors were encountered: