misc: Upgrade Go to v1.21

Upgrade to 1.21 as 1.20 is now unmaintained.

Most changes are related to the new `slices` package from standard
library, which can replace some existing custom functions.
This commit is contained in:
Michael Manganiello
2024-03-05 09:49:10 -03:00
parent ea1b2f3284
commit 801967a530
19 changed files with 47 additions and 104 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ package widgets
import (
"fmt"
"log"
"slices"
"sort"
"strconv"
"strings"
@@ -271,7 +272,7 @@ func (t *Tracklist) Sorting() TracklistSort {
func (t *Tracklist) SetSorting(sorting TracklistSort) {
if sorting.ColumnName == "" {
// nil case - reset current sort
if sharedutil.SliceContains(columns, t.sorting.ColumnName) {
if slices.Contains(columns, t.sorting.ColumnName) {
t.hdr.SetSorting(ListHeaderSort{ColNumber: ColNumber(t.sorting.ColumnName), Type: SortNone})
}
return
@@ -667,7 +668,7 @@ func (t *Tracklist) lenTracks() int {
}
func ColNumber(colName string) int {
i := sharedutil.IndexOf(columns, colName)
i := slices.Index(columns, colName)
if i < 0 {
log.Printf("error: Tracklist: invalid column name %s", colName)
}