vendor: upgrade github.com/hashicorp/hcl2

This includes a fix to prevent the creation of an invalid block object
when the configuration contains invalid template sequences in block
labels.
This commit is contained in:
Martin Atkins 2018-12-19 14:41:33 -08:00
parent cf9499cb78
commit 62481963b4
4 changed files with 18 additions and 17 deletions

2
go.mod
View File

@ -72,7 +72,7 @@ require (
github.com/hashicorp/go-version v1.0.0
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f
github.com/hashicorp/hcl2 v0.0.0-20181215005721-253da47fd604
github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250
github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3
github.com/hashicorp/memberlist v0.1.0 // indirect

2
go.sum
View File

@ -167,6 +167,8 @@ github.com/hashicorp/hcl2 v0.0.0-20181214235302-dac4796ca146 h1:y2SWlAjINnc8OYpc
github.com/hashicorp/hcl2 v0.0.0-20181214235302-dac4796ca146/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
github.com/hashicorp/hcl2 v0.0.0-20181215005721-253da47fd604 h1:k660QMbAqhL4vxSNPmvOAjzZJ7BQiwTrT8pa8RH3OEA=
github.com/hashicorp/hcl2 v0.0.0-20181215005721-253da47fd604/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d h1:sd9/19rMHTRn7UTYTBoGIzm93cHopNrpuv+jnx/LY34=
github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250 h1:fooK5IvDL/KIsi4LxF/JH68nVdrBSiGNPhS2JAQjtjo=
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts=
github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3 h1:oD64EFjELI9RY9yoWlfua58r+etdnoIC871z+rr6lkA=

View File

@ -286,19 +286,9 @@ Token:
diags = append(diags, labelDiags...)
labels = append(labels, label)
labelRanges = append(labelRanges, labelRange)
if labelDiags.HasErrors() {
p.recoverAfterBodyItem()
return &Block{
Type: blockType,
Labels: labels,
Body: nil,
TypeRange: ident.Range,
LabelRanges: labelRanges,
OpenBraceRange: ident.Range, // placeholder
CloseBraceRange: ident.Range, // placeholder
}, diags
}
// parseQuoteStringLiteral recovers up to the closing quote
// if it encounters problems, so we can continue looking for
// more labels and eventually the block body even.
case TokenIdent:
tok = p.Read() // eat token
@ -1648,7 +1638,16 @@ Token:
Subject: &tok.Range,
Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(),
})
p.recover(TokenTemplateSeqEnd)
// Now that we're returning an error callers won't attempt to use
// the result for any real operations, but they might try to use
// the partial AST for other analyses, so we'll leave a marker
// to indicate that there was something invalid in the string to
// help avoid misinterpretation of the partial result
ret.WriteString(which)
ret.WriteString("{ ... }")
p.recover(TokenTemplateSeqEnd) // we'll try to keep parsing after the sequence ends
case TokenEOF:
diags = append(diags, &hcl.Diagnostic{
@ -1669,7 +1668,7 @@ Token:
Subject: &tok.Range,
Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(),
})
p.recover(TokenOQuote)
p.recover(TokenCQuote)
break Token
}

2
vendor/modules.txt vendored
View File

@ -351,7 +351,7 @@ github.com/hashicorp/hcl/hcl/scanner
github.com/hashicorp/hcl/hcl/strconv
github.com/hashicorp/hcl/json/scanner
github.com/hashicorp/hcl/json/token
# github.com/hashicorp/hcl2 v0.0.0-20181215005721-253da47fd604
# github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d
github.com/hashicorp/hcl2/hcl
github.com/hashicorp/hcl2/hcl/hclsyntax
github.com/hashicorp/hcl2/hcldec