Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Conversation

@runcom
Copy link
Contributor

@runcom runcom commented Jul 7, 2016

  • First commit deals with an O(N) routine and removes it (the last layer ID index takes N-1 cycle to be found)
  • Second commit remove a reader close call because the reader is used after the function returns

Signed-off-by: Antonio Murdaca <[email protected]>
if err != nil {
return nil, nil, err
}
defer res.Body.Close()
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed that the original res doesn't get closed if this if block gets dropped into. Would you mind adding a res.Body.Close() around like 507 while you're here?

Copy link
Contributor Author

@runcom runcom Jul 7, 2016

Choose a reason for hiding this comment

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

there's a problem however, response body closing is an issue in all of this routine in case of any errors during the function, I'll add a defer

@cgonyeo
Copy link
Member

cgonyeo commented Jul 7, 2016

LGTM

@runcom
Copy link
Contributor Author

runcom commented Jul 7, 2016

@dgonyeo reworked the second commit so that if there's an error and the res var isn't nil then we close the body

}

defer func() {
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Just "and" those to save indentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to and

@iaguis
Copy link
Member

iaguis commented Jul 8, 2016

One nit but LGTM afterwards.

Signed-off-by: Antonio Murdaca <[email protected]>
@iaguis
Copy link
Member

iaguis commented Jul 8, 2016

Thanks!

@iaguis iaguis merged commit 619e96c into appc:master Jul 8, 2016
@runcom runcom deleted the fixies branch July 8, 2016 09:56
@iaguis iaguis modified the milestones: v0.13.0, v0.12.1 Jul 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants