Fix linter violation
This code triggered the "gocritic: ifElseChain: rewrite if-else to
switch statement" linter, and caused the static QA
job to fail (e.g.
https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/7084237751).
Strangely the change was introduced in !4557 (merged), but the linter violation did not happen in that MR's pipeline.