chore(gosec): enable gosec and address findings

This commit is contained in:
Hein
2026-09-30 13:16:12 +02:00
parent 9533c3a0ed
commit f66930c3c9
37 changed files with 133 additions and 122 deletions
+3 -3
View File
@@ -254,7 +254,7 @@ func (n SqlNull[T]) Int64() int64 {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return v.Int()
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return int64(v.Uint())
return int64(v.Uint()) //nolint:gosec // G115: value range bounded by caller/type, conversion intentional
case reflect.Float32, reflect.Float64:
return int64(v.Float())
case reflect.String:
@@ -556,7 +556,7 @@ func TryIfInt64(v any, def int64) int64 {
case int64:
return val
case uint:
return int64(val)
return int64(val) //nolint:gosec // G115: value range bounded by caller/type, conversion intentional
case uint8:
return int64(val)
case uint16:
@@ -564,7 +564,7 @@ func TryIfInt64(v any, def int64) int64 {
case uint32:
return int64(val)
case uint64:
return int64(val)
return int64(val) //nolint:gosec // G115: value range bounded by caller/type, conversion intentional
case float32:
return int64(val)
case float64:
+1 -1
View File
@@ -152,7 +152,7 @@ func (v *SqlSparseVector) Scan(value any) error {
if len(kv) != 2 {
return fmt.Errorf("SqlSparseVector: bad pair %q", pair)
}
k, err := strconv.Atoi(strings.TrimSpace(kv[0]))
k, err := strconv.ParseInt(strings.TrimSpace(kv[0]), 10, 32)
if err != nil {
return fmt.Errorf("SqlSparseVector: bad index %q: %w", kv[0], err)
}