godeps: bump github.com/coreos/yaml
This commit is contained in:
parent
057ab37364
commit
4ed1d03c97
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/coreos/yaml",
|
"ImportPath": "github.com/coreos/yaml",
|
||||||
"Rev": "9f9df34309c04878acc86042b16630b0f696e1de"
|
"Rev": "6b16a5714269b2f70720a45406b1babd947a17ef"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/dotcloud/docker/pkg/netlink",
|
"ImportPath": "github.com/dotcloud/docker/pkg/netlink",
|
||||||
|
3
Godeps/_workspace/src/github.com/coreos/yaml/README.md
generated
vendored
3
Godeps/_workspace/src/github.com/coreos/yaml/README.md
generated
vendored
@ -1,3 +1,6 @@
|
|||||||
|
Note: This is a fork of https://github.com/go-yaml/yaml. The following README
|
||||||
|
doesn't necessarily apply to this fork.
|
||||||
|
|
||||||
# YAML support for the Go language
|
# YAML support for the Go language
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
|
17
Godeps/_workspace/src/github.com/coreos/yaml/decode.go
generated
vendored
17
Godeps/_workspace/src/github.com/coreos/yaml/decode.go
generated
vendored
@ -30,13 +30,15 @@ type node struct {
|
|||||||
// Parser, produces a node tree out of a libyaml event stream.
|
// Parser, produces a node tree out of a libyaml event stream.
|
||||||
|
|
||||||
type parser struct {
|
type parser struct {
|
||||||
parser yaml_parser_t
|
parser yaml_parser_t
|
||||||
event yaml_event_t
|
event yaml_event_t
|
||||||
doc *node
|
doc *node
|
||||||
|
transform transformString
|
||||||
}
|
}
|
||||||
|
|
||||||
func newParser(b []byte) *parser {
|
func newParser(b []byte, t transformString) *parser {
|
||||||
p := parser{}
|
p := parser{transform: t}
|
||||||
|
|
||||||
if !yaml_parser_initialize(&p.parser) {
|
if !yaml_parser_initialize(&p.parser) {
|
||||||
panic("Failed to initialize YAML emitter")
|
panic("Failed to initialize YAML emitter")
|
||||||
}
|
}
|
||||||
@ -175,7 +177,10 @@ func (p *parser) mapping() *node {
|
|||||||
p.anchor(n, p.event.anchor)
|
p.anchor(n, p.event.anchor)
|
||||||
p.skip()
|
p.skip()
|
||||||
for p.event.typ != yaml_MAPPING_END_EVENT {
|
for p.event.typ != yaml_MAPPING_END_EVENT {
|
||||||
n.children = append(n.children, p.parse(), p.parse())
|
key := p.parse()
|
||||||
|
key.value = p.transform(key.value)
|
||||||
|
value := p.parse()
|
||||||
|
n.children = append(n.children, key, value)
|
||||||
}
|
}
|
||||||
p.skip()
|
p.skip()
|
||||||
return n
|
return n
|
||||||
|
19
Godeps/_workspace/src/github.com/coreos/yaml/decode_test.go
generated
vendored
19
Godeps/_workspace/src/github.com/coreos/yaml/decode_test.go
generated
vendored
@ -1,8 +1,8 @@
|
|||||||
package yaml_test
|
package yaml_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/coreos/yaml"
|
||||||
. "gopkg.in/check.v1"
|
. "gopkg.in/check.v1"
|
||||||
"gopkg.in/yaml.v1"
|
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@ -557,6 +557,23 @@ func (s *S) TestUnmarshalWithFalseSetterIgnoresValue(c *C) {
|
|||||||
c.Assert(m["ghi"].value, Equals, 3)
|
c.Assert(m["ghi"].value, Equals, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *S) TestUnmarshalWithTransform(c *C) {
|
||||||
|
data := `{a_b: 1, c-d: 2, e-f_g: 3, h_i-j: 4}`
|
||||||
|
expect := map[string]int{
|
||||||
|
"a_b": 1,
|
||||||
|
"c_d": 2,
|
||||||
|
"e_f_g": 3,
|
||||||
|
"h_i_j": 4,
|
||||||
|
}
|
||||||
|
m := map[string]int{}
|
||||||
|
yaml.UnmarshalMappingKeyTransform = func(i string) string {
|
||||||
|
return strings.Replace(i, "-", "_", -1)
|
||||||
|
}
|
||||||
|
err := yaml.Unmarshal([]byte(data), m)
|
||||||
|
c.Assert(err, IsNil)
|
||||||
|
c.Assert(m, DeepEquals, expect)
|
||||||
|
}
|
||||||
|
|
||||||
// From http://yaml.org/type/merge.html
|
// From http://yaml.org/type/merge.html
|
||||||
var mergeTests = `
|
var mergeTests = `
|
||||||
anchors:
|
anchors:
|
||||||
|
2
Godeps/_workspace/src/github.com/coreos/yaml/encode_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/coreos/yaml/encode_test.go
generated
vendored
@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/coreos/yaml"
|
||||||
. "gopkg.in/check.v1"
|
. "gopkg.in/check.v1"
|
||||||
"gopkg.in/yaml.v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var marshalIntTest = 123
|
var marshalIntTest = 123
|
||||||
|
13
Godeps/_workspace/src/github.com/coreos/yaml/yaml.go
generated
vendored
13
Godeps/_workspace/src/github.com/coreos/yaml/yaml.go
generated
vendored
@ -84,7 +84,7 @@ type Getter interface {
|
|||||||
func Unmarshal(in []byte, out interface{}) (err error) {
|
func Unmarshal(in []byte, out interface{}) (err error) {
|
||||||
defer handleErr(&err)
|
defer handleErr(&err)
|
||||||
d := newDecoder()
|
d := newDecoder()
|
||||||
p := newParser(in)
|
p := newParser(in, UnmarshalMappingKeyTransform)
|
||||||
defer p.destroy()
|
defer p.destroy()
|
||||||
node := p.parse()
|
node := p.parse()
|
||||||
if node != nil {
|
if node != nil {
|
||||||
@ -146,6 +146,17 @@ func Marshal(in interface{}) (out []byte, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalMappingKeyTransform is a string transformation that is applied to
|
||||||
|
// each mapping key in a YAML document before it is unmarshalled. By default,
|
||||||
|
// UnmarshalMappingKeyTransform is an identity transform (no modification).
|
||||||
|
var UnmarshalMappingKeyTransform transformString = identityTransform
|
||||||
|
|
||||||
|
type transformString func(in string) (out string)
|
||||||
|
|
||||||
|
func identityTransform(in string) (out string) {
|
||||||
|
return in
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Maintain a mapping of keys to structure field indexes
|
// Maintain a mapping of keys to structure field indexes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user