fixed some defects in the iter-list implementation

This commit is contained in:
2024-06-05 08:06:39 +02:00
parent 188ea354ee
commit 8144122d2c
4 changed files with 16 additions and 22 deletions
+3 -1
View File
@@ -204,8 +204,10 @@ func CloneFilteredMap[K comparable, V any](source map[K]V, filter func(key K) (a
func toInt(value any, description string) (i int, err error) {
if valueInt64, ok := value.(int64); ok {
i = int(valueInt64)
} else if valueInt, ok := value.(int); ok {
i = valueInt
} else {
err = fmt.Errorf("%s expected integer, got %T (%v)", description, value, value)
err = fmt.Errorf("%s expected integer, got %s (%v)", description, typeName(value), value)
}
return
}