This repository was archived by the owner on Feb 18, 2025. It is now read-only.
fix returned error values in defer functions#946
Merged
shlomi-noach merged 9 commits intomasterfrom Jan 12, 2020
Merged
Conversation
yangeagle
approved these changes
Aug 4, 2019
zmoazeni
approved these changes
Aug 5, 2019
zmoazeni
left a comment
There was a problem hiding this comment.
Hah. I was going through and creating a PR for this by adding a test file to the original repo. Beat me to the punch.
zmoazeni
reviewed
Aug 5, 2019
| }() | ||
|
|
||
| stmt, err := db.Prepare(query) | ||
| var stmt *sql.Stmt |
Collaborator
Author
There was a problem hiding this comment.
Huh. I wonder how this passed CI? CI checks diff vs. gofmt-ed code.
zmoazeni
added a commit
to zmoazeni/gh-ost
that referenced
this pull request
Aug 5, 2019
This is copied from openark/orchestrator#946 with a slight tweak to the an indent. Originates from the PR openark/orchestrator#943 that applies to this codebase too. When we define the variable and attempt to set it in a defer function, the value we're returning isn't what we expect. Instead we can name the return values as variables and set that instead.
Collaborator
Author
@zmoazeni please do |
Collaborator
Author
|
Sorry about the delay; I expect to look into & merge a bunch of community PRs during the first two weeks of October. |
|
All good @shlomi-noach. I've been super busy on my side too. Haven't done anything in OSS-land lately. |
added 6 commits
November 5, 2019 12:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #943 (and more scenarios like the one reported).
An
errwas not correctly returned when modified by adeferfunction insqlutils.go.