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

Unnecessary conditions in the code #245

Closed
dholbach opened this issue Oct 27, 2021 · 1 comment · Fixed by #284
Closed

Unnecessary conditions in the code #245

dholbach opened this issue Oct 27, 2021 · 1 comment · Fixed by #284
Labels
good first issue Good for newcomers

Comments

@dholbach
Copy link
Member

From Ada Logics

In the following code, the auto.Spec.Update is not needed, and if indeed auto.Spec.Update was nil then the first conditional statement would be panic due to a nil-dereference.

manifestsPath := tmp
if auto.Spec.Update.Path != "" {
tracelog.Info("adjusting update path according to .spec.update.path", "base", tmp, "spec-path", auto.Spec.Update.Path)
if p, err := securejoin.SecureJoin(tmp, auto.Spec.Update.Path); err != nil {
return failWithError(err)
} else {
manifestsPath = p
}
}
switch {
case auto.Spec.Update != nil && auto.Spec.Update.Strategy == imagev1.UpdateStrategySetters:

Recommendation
Remove unnecessary code.

@relu relu added the good first issue Good for newcomers label Nov 24, 2021
@Nalum
Copy link
Member

Nalum commented Dec 17, 2021

I'd like to take up this issue if that's good with you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants