vendor: upgrade go-cty-yaml dependency

Fixes #22223
This commit is contained in:
Kristin Laemmert 2019-07-30 12:27:49 -04:00
parent 7e6b05a95f
commit 664fb5d51e
11 changed files with 27 additions and 20 deletions

2
go.mod
View File

@ -116,7 +116,7 @@ require (
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 // indirect
github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557
github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f
github.com/zclconf/go-cty-yaml v0.1.0
github.com/zclconf/go-cty-yaml v1.0.1
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1 // indirect

6
go.sum
View File

@ -419,14 +419,12 @@ github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q
github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557 h1:Jpn2j6wHkC9wJv5iMfJhKqrZJx3TahFx+7sbZ7zQdxs=
github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
github.com/zclconf/go-cty v0.0.0-20181129180422-88fbe721e0f8/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec h1:MSeYjmyjucsFbecMTxg63ASg23lcSARP/kr9sClTFfk=
github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.0.0 h1:EWtv3gKe2wPLIB9hQRQJa7k/059oIfAqcEkCNnaVckk=
github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f h1:sq2p8SN6ji66CFEQFIWLlD/gFmGtr5hBrOzv5nLlGfA=
github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty-yaml v0.1.0 h1:OP5nkApyAuXB88t8mRUqxD9gbKZocSLuVovrBAt8z10=
github.com/zclconf/go-cty-yaml v0.1.0/go.mod h1:Lk26EcRlO3XbaQ8U2fxIJbEtbgEteSZFUpEr3XFTtsU=
github.com/zclconf/go-cty-yaml v1.0.1 h1:up11wlgAaDvlAGENcFDnZgkn0qUJurso7k6EpURKNF8=
github.com/zclconf/go-cty-yaml v1.0.1/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0=
go.opencensus.io v0.18.0 h1:Mk5rgZcggtbvtAun5aJzAtjKKN/t0R3jJPlWILlv938=
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=

View File

@ -59,6 +59,7 @@ func NewConstraint(v string) (Constraints, error) {
if err != nil {
return nil, err
}
result[i] = c
}

10
vendor/github.com/zclconf/go-cty-yaml/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,10 @@
# 1.0.1 (July 30, 2019)
* The YAML decoder is now correctly treating quoted scalars as verbatim literal
strings rather than using the fuzzy type selection rules for them. Fuzzy
type selection rules still apply to unquoted scalars.
([#4](https://github.com/zclconf/go-cty-yaml/pull/4))
# 1.0.0 (May 26, 2019)
Initial release.

View File

@ -100,7 +100,7 @@ func (c *Converter) unmarshalScalar(an *valueAnalysis, evt *yaml_event_t, p *yam
an.beginAnchor(anchor)
}
val, err := c.resolveScalar(tag, string(src))
val, err := c.resolveScalar(tag, string(src), yaml_scalar_style_t(evt.style))
if err != nil {
return cty.NilVal, parseEventErrorWrap(evt, err)
}
@ -145,7 +145,7 @@ func (c *Converter) unmarshalMapping(an *valueAnalysis, evt *yaml_event_t, p *ya
if nextEvt.typ != yaml_SCALAR_EVENT {
return cty.NilVal, parseEventErrorf(&nextEvt, "only strings are allowed as mapping keys")
}
keyVal, err := c.resolveScalar(string(nextEvt.tag), string(nextEvt.value))
keyVal, err := c.resolveScalar(string(nextEvt.tag), string(nextEvt.value), yaml_scalar_style_t(nextEvt.style))
if err != nil {
return cty.NilVal, err
}

View File

@ -97,12 +97,6 @@ func (c *Converter) marshalPrimitive(v cty.Value, e *yaml_emitter_t) error {
)
case cty.Number:
str := v.AsBigFloat().Text('f', -1)
switch v {
case cty.PositiveInfinity:
str = "+.Inf"
case cty.NegativeInfinity:
str = "-.Inf"
}
yaml_scalar_event_initialize(
&evt,
nil,

View File

@ -1,3 +1,3 @@
module github.com/zclconf/go-cty-yaml
require github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec
require github.com/zclconf/go-cty v1.0.0

View File

@ -7,8 +7,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec h1:MSeYjmyjucsFbecMTxg63ASg23lcSARP/kr9sClTFfk=
github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.0.0 h1:EWtv3gKe2wPLIB9hQRQJa7k/059oIfAqcEkCNnaVckk=
github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=

View File

@ -107,7 +107,7 @@ func (c *Converter) impliedTypeScalar(an *typeAnalysis, evt *yaml_event_t, p *ya
// Untagged explicit string
ty = cty.String
default:
v, err := c.resolveScalar(tag, string(src))
v, err := c.resolveScalar(tag, string(src), yaml_scalar_style_t(evt.style))
if err != nil {
return cty.NilType, parseEventErrorWrap(evt, err)
}
@ -154,7 +154,7 @@ func (c *Converter) impliedTypeMapping(an *typeAnalysis, evt *yaml_event_t, p *y
if nextEvt.typ != yaml_SCALAR_EVENT {
return cty.NilType, parseEventErrorf(&nextEvt, "only strings are allowed as mapping keys")
}
keyVal, err := c.resolveScalar(string(nextEvt.tag), string(nextEvt.value))
keyVal, err := c.resolveScalar(string(nextEvt.tag), string(nextEvt.value), yaml_scalar_style_t(nextEvt.style))
if err != nil {
return cty.NilType, err
}

View File

@ -84,7 +84,7 @@ func resolvableTag(tag string) bool {
var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`)
func (c *Converter) resolveScalar(tag string, src string) (cty.Value, error) {
func (c *Converter) resolveScalar(tag string, src string, style yaml_scalar_style_t) (cty.Value, error) {
if !resolvableTag(tag) {
return cty.NilVal, fmt.Errorf("unsupported tag %q", tag)
}
@ -96,6 +96,10 @@ func (c *Converter) resolveScalar(tag string, src string) (cty.Value, error) {
hint = resolveTable[src[0]]
}
if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG {
if style == yaml_SINGLE_QUOTED_SCALAR_STYLE || style == yaml_DOUBLE_QUOTED_SCALAR_STYLE {
return cty.StringVal(src), nil
}
// Handle things we can lookup in a map.
if item, ok := resolveMap[src]; ok {
return item.value, nil

2
vendor/modules.txt vendored
View File

@ -469,7 +469,7 @@ github.com/zclconf/go-cty/cty/function
github.com/zclconf/go-cty/cty/function/stdlib
github.com/zclconf/go-cty/cty/msgpack
github.com/zclconf/go-cty/cty/set
# github.com/zclconf/go-cty-yaml v0.1.0
# github.com/zclconf/go-cty-yaml v1.0.1
github.com/zclconf/go-cty-yaml
# go.opencensus.io v0.18.0
go.opencensus.io/trace