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 99 directory : " /" # Location of package manifests
1010 schedule :
1111 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
22
33on :
44 push :
5- branches : [ main ]
5+ branches :
6+ - main
67 pull_request :
7- branches : [ main ]
8+
9+ permissions :
10+ contents : read
811
912jobs :
10- build :
11- name : Build
13+ lint :
14+ name : lint
1215 runs-on : ubuntu-latest
1316 steps :
14- - name : Set up Go
15- uses : actions/setup-go@v2
17+ - uses : actions/checkout@v4
18+ - uses : actions/setup-go@v5
1619 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
2437 env :
2538 CGO_ENABLED : 0
2639 GO111MODULE : on
2740 GOOS : linux
2841 GOARCH : amd64
29-
30- - name : Send coverage
42+ - name : send coverage
3143 uses : shogo82148/actions-goveralls@v1
3244 with :
3345 path-to-profile : cover.out
Original file line number Diff line number Diff line change 11# jsonpatch
22[ ![ GitHub Action] ( https://img.shields.io/badge/GitHub-Action-blue )] ( https://github.com/features/actions )
33[ ![ 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 )
55[ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/snorwin/jsonpatch )] ( https://goreportcard.com/report/github.com/snorwin/jsonpatch )
66[ ![ Coverage Status] ( https://coveralls.io/repos/github/snorwin/jsonpatch/badge.svg?branch=main )] ( https://coveralls.io/github/snorwin/jsonpatch?branch=main )
77[ ![ 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
33import (
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
4243func (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
You can’t perform that action at this time.
0 commit comments