chore(deps): bump github.com/TwiN/deepmerge from 0.1.0 to 0.2.0 (#401)
Bumps [github.com/TwiN/deepmerge](https://github.com/TwiN/deepmerge) from 0.1.0 to 0.2.0. - [Release notes](https://github.com/TwiN/deepmerge/releases) - [Commits](https://github.com/TwiN/deepmerge/compare/v0.1.0...v0.2.0) --- updated-dependencies: - dependency-name: github.com/TwiN/deepmerge dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
80
vendor/github.com/TwiN/deepmerge/README.md
generated
vendored
80
vendor/github.com/TwiN/deepmerge/README.md
generated
vendored
@ -1,10 +1,12 @@
|
||||
# deepmerge
|
||||

|
||||
|
||||
Go library for deep merging YAML files.
|
||||
Go library for deep merging YAML or JSON files.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### YAML
|
||||
```go
|
||||
package main
|
||||
|
||||
@ -31,7 +33,6 @@ users:
|
||||
- id: 3
|
||||
firstName: Bob
|
||||
lastName: Smith`
|
||||
|
||||
output, err := deepmerge.YAML([]byte(dst), []byte(src))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -56,4 +57,79 @@ users:
|
||||
- firstName: Bob
|
||||
id: 3
|
||||
lastName: Smith
|
||||
```
|
||||
|
||||
### JSON
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/TwiN/deepmerge"
|
||||
)
|
||||
|
||||
func main() {
|
||||
dst := `{
|
||||
"debug": true,
|
||||
"client": {
|
||||
"insecure": true
|
||||
},
|
||||
"users": [
|
||||
{
|
||||
"id": 1,
|
||||
"firstName": "John",
|
||||
"lastName": "Doe"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"firstName": "Jane",
|
||||
"lastName": "Doe"
|
||||
}
|
||||
]
|
||||
}`
|
||||
src := `{
|
||||
"client": {
|
||||
"timeout": "5s"
|
||||
},
|
||||
"users": [
|
||||
{
|
||||
"id": 3,
|
||||
"firstName": "Bob",
|
||||
"lastName": "Smith"
|
||||
}
|
||||
]
|
||||
}`
|
||||
output, err := deepmerge.JSON([]byte(dst), []byte(src))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
println(string(output))
|
||||
}
|
||||
```
|
||||
|
||||
Output:
|
||||
```json
|
||||
{
|
||||
"client": {
|
||||
"insecure": true,
|
||||
"timeout": "5s"
|
||||
},
|
||||
"debug": true,
|
||||
"users": [
|
||||
{
|
||||
"firstName": "John",
|
||||
"id": 1,
|
||||
"lastName": "Doe"
|
||||
},
|
||||
{
|
||||
"firstName": "Jane",
|
||||
"id": 2,
|
||||
"lastName": "Doe"
|
||||
},
|
||||
{
|
||||
"firstName": "Bob",
|
||||
"id": 3,
|
||||
"lastName": "Smith"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user