Skip to content

Conversation

@hzue
Copy link
Contributor

@hzue hzue commented Jul 1, 2018

Fix the error from bridgeSetup doesn't handle by the defer function in the createNetwork function.

Signed-off-by: Terry Chu jubosh.tw@gmail.com

// Apply the prepared list of steps, and abort at the first error.
bridgeSetup.queueStep(setupDeviceUp)
return bridgeSetup.apply()
if err = bridgeSetup.apply(); err != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better if you change the method prototype like this:

func (d *driver) createNetwork(config *networkConfiguration) (err error) {

and remove line 618
that way we are sure that if the body of this function has a return the defer is still being honored

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were going that route I'd probably suggest something less generic than err. It's almost idiomatic to shadow it.

@fcrisciani
Copy link

Thanks @hzue, I left a comment on the patch

Copy link
Contributor

@ctelfer ctelfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- hate these types of errors!

Fix the error from bridgeSetup doesn't handle by the defer function in the createNetwork function.

Signed-off-by: Terry Chu <jubosh.tw@gmail.com>
@hzue
Copy link
Contributor Author

hzue commented Jul 5, 2018

Hi @fcrisciani @ctelfer, thanks for your advice.
I have updated the commit.

@ctelfer
Copy link
Contributor

ctelfer commented Jul 5, 2018

Still LGTM.

Copy link

@fcrisciani fcrisciani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fcrisciani
Copy link

Thanks @hzue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants