Skip to content
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

Missing return statement after error #244

Closed
dholbach opened this issue Oct 27, 2021 · 1 comment
Closed

Missing return statement after error #244

dholbach opened this issue Oct 27, 2021 · 1 comment

Comments

@dholbach
Copy link
Member

From Ada Logics

In the Image-automation reconciler an issue is present where the code continues after an error occurs, leading to undefined behaviour:

// Here's where it gets constrained. If there's no push branch
// given, then the checkout ref must include a branch, and
// that can be used.
if ref == nil || ref.Branch == "" {
return failWithError(fmt.Errorf("Push branch not given explicitly, and cannot be inferred from .spec.git.checkout.ref or GitRepository .spec.ref"))
}
pushBranch = ref.Branch
tracelog.Info("using push branch from $ref.branch", "branch", pushBranch)

The problem is that the failWithError branch does not itself return from the reconcile function and the code should instead be return failWithError

Recommendation

Change the code to return failWithError

@relu
Copy link
Member

relu commented Nov 11, 2021

Fixed in 5a831a8.

@relu relu closed this as completed Nov 11, 2021
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

No branches or pull requests

2 participants