-
Notifications
You must be signed in to change notification settings - Fork 39
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
ref(docker.go): container config fields on Driver no longer pointers #206
Conversation
Signed-off-by: Vaughn Dice <[email protected]>
Signed-off-by: Vaughn Dice <[email protected]>
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 think that in this case, there was nothing gained by having containerHostCfg
and conatinerCfg
as pointers. We weren't using it to share data, represent uninitialized data, etc, and were immediately initializing it to an empty struct before calling d.ApplyConfigurationOptions()
anyway. 🤷♀️
Signed-off-by: Vaughn Dice <[email protected]>
d7cf37d
to
9b6875f
Compare
Signed-off-by: Vaughn Dice <[email protected]>
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.
Looks great, thanks for your patience while we worked out the mechanics of how we wanted this to work for users of the library!
@@ -31,15 +30,15 @@ func TestDriver_GetConfigurationOptions(t *testing.T) { | |||
}) | |||
|
|||
t.Run("configuration options", func(t *testing.T) { | |||
d.containerCfg = &container.Config{} | |||
d.containerHostCfg = &container.HostConfig{} | |||
d := &Driver{} |
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 is much cleaner to work with
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
update config fields on Driver struct to not be pointers
containerCfg
andcontainerHostCfg
). I started to go down the path of creating methods in this library to return default Driver objects (NewDriver()
would return aDriver
with initialized/empty field references) but then I realized perhaps the code simplifications and ease of use that came with switching the fields to be actual values would be warranted here. What do reviewers think? Is there Golang best practice w/r/t fields in structs being pointers? (Avoid? Only use if initializer method(s) are provided?)export ApplyConfigurationOptions
exec
on the driver in unit tests