✨ use vgo
This commit is contained in:
26
vendor/github.com/appscode/jsonpatch/.gitignore
generated
vendored
Normal file
26
vendor/github.com/appscode/jsonpatch/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
.idea/
|
||||
10
vendor/github.com/appscode/jsonpatch/.travis.yml
generated
vendored
Normal file
10
vendor/github.com/appscode/jsonpatch/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.x
|
||||
- tip
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
script:
|
||||
- go test -v
|
||||
53
vendor/github.com/appscode/jsonpatch/README.md
generated
vendored
Normal file
53
vendor/github.com/appscode/jsonpatch/README.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# jsonpatch
|
||||
|
||||
[](https://travis-ci.org/appscode/jsonpatch)
|
||||
[](https://goreportcard.com/report/appscode/jsonpatch)
|
||||
[](https://godoc.org/github.com/appscode/jsonpatch)
|
||||
|
||||
As per http://jsonpatch.com JSON Patch is specified in RFC 6902 from the IETF.
|
||||
|
||||
JSON Patch allows you to generate JSON that describes changes you want to make to a document, so you don't have to send the whole doc. JSON Patch format is supported by HTTP PATCH method, allowing for standards based partial updates via REST APIs.
|
||||
|
||||
```console
|
||||
go get github.com/appscode/jsonpatch
|
||||
```
|
||||
|
||||
I tried some of the other "jsonpatch" go implementations, but none of them could diff two json documents and
|
||||
generate format like jsonpatch.com specifies. Here's an example of the patch format:
|
||||
|
||||
```json
|
||||
[
|
||||
{ "op": "replace", "path": "/baz", "value": "boo" },
|
||||
{ "op": "add", "path": "/hello", "value": ["world"] },
|
||||
{ "op": "remove", "path": "/foo"}
|
||||
]
|
||||
|
||||
```
|
||||
The API is super simple
|
||||
|
||||
## example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appscode/jsonpatch"
|
||||
)
|
||||
|
||||
var simpleA = `{"a":100, "b":200, "c":"hello"}`
|
||||
var simpleB = `{"a":100, "b":200, "c":"goodbye"}`
|
||||
|
||||
func main() {
|
||||
patch, e := jsonpatch.CreatePatch([]byte(simpleA), []byte(simpleA))
|
||||
if e != nil {
|
||||
fmt.Printf("Error creating JSON patch:%v", e)
|
||||
return
|
||||
}
|
||||
for _, operation := range patch {
|
||||
fmt.Printf("%s\n", operation.Json())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This code needs more tests, as it's a highly recursive, type-fiddly monster. It's not a lot of code, but it has to deal with a lot of complexity.
|
||||
8
vendor/github.com/appscode/jsonpatch/go.mod
generated
vendored
Normal file
8
vendor/github.com/appscode/jsonpatch/go.mod
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
module github.com/appscode/jsonpatch
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/evanphx/json-patch v4.0.0+incompatible
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
)
|
||||
8
vendor/github.com/appscode/jsonpatch/go.sum
generated
vendored
Normal file
8
vendor/github.com/appscode/jsonpatch/go.sum
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/evanphx/json-patch v4.0.0+incompatible h1:xregGRMLBeuRcwiOTHRCsPPuzCQlqhxUPbqdw+zNkLc=
|
||||
github.com/evanphx/json-patch v4.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
Reference in New Issue
Block a user