File tree Expand file tree Collapse file tree 4 files changed +35
-24
lines changed Expand file tree Collapse file tree 4 files changed +35
-24
lines changed Original file line number Diff line number Diff line change 9
9
directory : " /" # Location of package manifests
10
10
schedule :
11
11
interval : " weekly"
12
+ - package-ecosystem : " github-actions"
13
+ directory : " /"
14
+ schedule :
15
+ interval : " weekly"
Original file line number Diff line number Diff line change 1
- name : Test
1
+ name : test
2
2
3
3
on :
4
4
push :
5
- branches : [ main ]
5
+ branches :
6
+ - main
6
7
pull_request :
7
- branches : [ main ]
8
+
9
+ permissions :
10
+ contents : read
8
11
9
12
jobs :
10
- build :
11
- name : Build
13
+ lint :
14
+ name : lint
12
15
runs-on : ubuntu-latest
13
16
steps :
14
- - name : Set up Go
15
- uses : actions/setup-go@v2
17
+ - uses : actions/checkout@v4
18
+ - uses : actions/setup-go@v5
16
19
with :
17
- go-version : ^1.15
18
-
19
- - name : Checkout
20
- uses : actions/checkout@v2
21
-
22
- - name : Test
23
- run : go test ./... -coverprofile cover.out -timeout 30m
20
+ go-version : ^1.22
21
+ cache : false
22
+ - name : golangci-lint
23
+ uses : golangci/golangci-lint-action@v4
24
+ with :
25
+ version : v1.54
26
+ test :
27
+ name : go test
28
+ runs-on : ubuntu-latest
29
+ steps :
30
+ - uses : actions/checkout@v4
31
+ - uses : actions/setup-go@v5
32
+ with :
33
+ go-version : ^1.22
34
+ cache : false
35
+ - name : go test
36
+ run : go test -coverprofile cover.out -timeout 30m
24
37
env :
25
38
CGO_ENABLED : 0
26
39
GO111MODULE : on
27
40
GOOS : linux
28
41
GOARCH : amd64
29
-
30
- - name : Send coverage
42
+ - name : send coverage
31
43
uses : shogo82148/actions-goveralls@v1
32
44
with :
33
45
path-to-profile : cover.out
Original file line number Diff line number Diff line change 1
1
# jsonpatch
2
2
[ ![ GitHub Action] ( https://img.shields.io/badge/GitHub-Action-blue )] ( https://github.com/features/actions )
3
3
[ ![ Documentation] ( https://img.shields.io/badge/godoc-reference-5272B4.svg )] ( https://pkg.go.dev/github.com/snorwin/jsonpatch )
4
- [ ![ Test] ( https://img.shields.io/github/workflow/status/snorwin/jsonpatch/Test ?label=tests&logo=github )] ( https://github.com/snorwin/jsonpatch /actions )
4
+ [ ![ Test] ( https://img.shields.io/github/actions/ workflow/status/snorwin/jsonpatch/test.yaml ?label=tests&logo=github )] ( https://github.com/snorwin/sonpatch /actions )
5
5
[ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/snorwin/jsonpatch )] ( https://goreportcard.com/report/github.com/snorwin/jsonpatch )
6
6
[ ![ Coverage Status] ( https://coveralls.io/repos/github/snorwin/jsonpatch/badge.svg?branch=main )] ( https://coveralls.io/github/snorwin/jsonpatch?branch=main )
7
7
[ ![ Releases] ( https://img.shields.io/github/v/release/snorwin/jsonpatch )] ( https://github.com/snorwin/jsonpatch/releases )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package jsonpatch
3
3
import (
4
4
"encoding/json"
5
5
"reflect"
6
+ "slices"
6
7
)
7
8
8
9
// JSONPatch format is specified in RFC 6902
@@ -40,13 +41,7 @@ func (l JSONPatchList) Raw() []byte {
40
41
41
42
// List returns a copy of the underlying JSONPatch slice
42
43
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 )
50
45
}
51
46
52
47
// CreateJSONPatch compares two JSON data structures and creates a JSONPatch according to RFC 6902
You can’t perform that action at this time.
0 commit comments