Skip to content

Commit 140e741

Browse files
committed
Fix lint issues
1 parent 2e7f2c0 commit 140e741

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

patch.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package jsonpatch
33
import (
44
"encoding/json"
55
"reflect"
6+
"slices"
67
)
78

89
// JSONPatch format is specified in RFC 6902
@@ -40,13 +41,7 @@ func (l JSONPatchList) Raw() []byte {
4041

4142
// List returns a copy of the underlying JSONPatch slice
4243
func (l JSONPatchList) List() []JSONPatch {
43-
ret := make([]JSONPatch, l.Len())
44-
45-
for i, patch := range l.list {
46-
ret[i] = patch
47-
}
48-
49-
return ret
44+
return slices.Clone(l.list)
5045
}
5146

5247
// CreateJSONPatch compares two JSON data structures and creates a JSONPatch according to RFC 6902

0 commit comments

Comments
 (0)