fix: Convert if-else chains to switch statements for staticcheck QF1003
- Convert cvIcons migration logic to switch statement (line 103-110) - Convert currentIcons migration logic to switch statement (line 861-866) - Resolves golangci-lint staticcheck QF1003 warnings in GitHub Actions
This commit is contained in:
@@ -100,10 +100,11 @@ func (h *CVHandler) Home(w http.ResponseWriter, r *http.Request) {
|
|||||||
cvLength = "long"
|
cvLength = "long"
|
||||||
setPreferenceCookie(w, "cv-length", "long")
|
setPreferenceCookie(w, "cv-length", "long")
|
||||||
}
|
}
|
||||||
if cvIcons == "true" {
|
switch cvIcons {
|
||||||
|
case "true":
|
||||||
cvIcons = "show"
|
cvIcons = "show"
|
||||||
setPreferenceCookie(w, "cv-icons", "show")
|
setPreferenceCookie(w, "cv-icons", "show")
|
||||||
} else if cvIcons == "false" {
|
case "false":
|
||||||
cvIcons = "hide"
|
cvIcons = "hide"
|
||||||
setPreferenceCookie(w, "cv-icons", "hide")
|
setPreferenceCookie(w, "cv-icons", "hide")
|
||||||
}
|
}
|
||||||
@@ -857,9 +858,10 @@ func (h *CVHandler) ToggleIcons(w http.ResponseWriter, r *http.Request) {
|
|||||||
currentIcons := getPreferenceCookie(r, "cv-icons", "show")
|
currentIcons := getPreferenceCookie(r, "cv-icons", "show")
|
||||||
|
|
||||||
// Migrate old values if needed
|
// Migrate old values if needed
|
||||||
if currentIcons == "true" {
|
switch currentIcons {
|
||||||
|
case "true":
|
||||||
currentIcons = "show"
|
currentIcons = "show"
|
||||||
} else if currentIcons == "false" {
|
case "false":
|
||||||
currentIcons = "hide"
|
currentIcons = "hide"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user