refactor: use slices.Index/Delete and slices.Clone for small copies

This commit is contained in:
sam committed 2026-10-10 11:14:36 +11:00
1 parent c86368369f
commit 20d6ec93db
2 files changed
+8 -15

No files matched your search

+4 -9
View File
@@ -8,6 +8,7 @@ import (
"context"
"encoding/json"
"fmt"
"slices"
)
// JSONSchema represents a JSON Schema document describing a tool's input
@@ -169,17 +170,11 @@ func deepCopyAny(v any) any {
}
return out
case []string:
out := make([]string, len(val))
copy(out, val)
return out
return slices.Clone(val)
case []float64:
out := make([]float64, len(val))
copy(out, val)
return out
return slices.Clone(val)
case []bool:
out := make([]bool, len(val))
copy(out, val)
return out
return slices.Clone(val)
default:
return v
}