upgrade gopkg.in/yaml.v2 to gopkg.in/yaml.v3

This commit is contained in:
Inteon 2021-12-15 23:13:53 +01:00
parent 04d3a0cb02
commit 8317acfc14
No known key found for this signature in database
GPG key ID: BD5DCF7303C7C1A7
5 changed files with 58 additions and 56 deletions

View file

@ -195,9 +195,9 @@ var yamlExample = []byte(`
Hacker: true Hacker: true
name: steve name: steve
hobbies: hobbies:
- skateboarding - skateboarding
- snowboarding - snowboarding
- go - go
clothing: clothing:
jacket: leather jacket: leather
trousers: denim trousers: denim
@ -794,7 +794,7 @@ You can use your favorite format's marshaller with the config returned by `AllSe
```go ```go
import ( import (
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v3"
// ... // ...
) )

4
go.mod
View file

@ -16,7 +16,7 @@ require (
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/subosito/gotenv v1.2.0 github.com/subosito/gotenv v1.2.0
gopkg.in/ini.v1 v1.66.2 gopkg.in/ini.v1 v1.66.2
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
) )
require ( require (
@ -65,5 +65,5 @@ require (
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.43.0 // indirect google.golang.org/grpc v1.43.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
) )

View file

@ -1,6 +1,8 @@
package yaml package yaml
import "gopkg.in/yaml.v2" import (
"gopkg.in/yaml.v3"
)
// Codec implements the encoding.Encoder and encoding.Decoder interfaces for YAML encoding. // Codec implements the encoding.Encoder and encoding.Decoder interfaces for YAML encoding.
type Codec struct{} type Codec struct{}

View file

@ -9,9 +9,9 @@ import (
const original = `# key-value pair const original = `# key-value pair
key: value key: value
list: list:
- item1 - item1
- item2 - item2
- item3 - item3
map: map:
key: value key: value
@ -29,9 +29,9 @@ nested_map:
// encoded form of the data // encoded form of the data
const encoded = `key: value const encoded = `key: value
list: list:
- item1 - item1
- item2 - item2
- item3 - item3
map: map:
key: value key: value
nested_map: nested_map:
@ -54,11 +54,11 @@ var decoded = map[string]interface{}{
"item2", "item2",
"item3", "item3",
}, },
"map": map[interface{}]interface{}{ "map": map[string]interface{}{
"key": "value", "key": "value",
}, },
"nested_map": map[interface{}]interface{}{ "nested_map": map[string]interface{}{
"map": map[interface{}]interface{}{ "map": map[string]interface{}{
"key": "value", "key": "value",
"list": []interface{}{ "list": []interface{}{
"item1", "item1",

View file

@ -36,9 +36,9 @@ import (
var yamlExample = []byte(`Hacker: true var yamlExample = []byte(`Hacker: true
name: steve name: steve
hobbies: hobbies:
- skateboarding - skateboarding
- snowboarding - snowboarding
- go - go
clothing: clothing:
jacket: leather jacket: leather
trousers: denim trousers: denim
@ -1568,9 +1568,9 @@ clothing:
eyes: brown eyes: brown
hacker: true hacker: true
hobbies: hobbies:
- skateboarding - skateboarding
- snowboarding - snowboarding
- go - go
name: steve name: steve
`) `)