Remove duplicate code

This commit is contained in:
onee-only
2024-03-04 12:55:59 +09:00
committed by Junegunn Choi
parent 7444eff6d4
commit 8061a2f108
2 changed files with 7 additions and 10 deletions

View File

@@ -236,17 +236,15 @@ func parseGetParams(query string) getParams {
for _, pair := range strings.Split(query, "&") {
parts := strings.SplitN(pair, "=", 2)
if len(parts) == 2 {
val, err := strconv.Atoi(parts[1])
if err != nil {
continue
}
switch parts[0] {
case "limit":
val, err := strconv.Atoi(parts[1])
if err == nil {
params.limit = val
}
params.limit = val
case "offset":
val, err := strconv.Atoi(parts[1])
if err == nil {
params.offset = val
}
params.offset = val
}
}
}