replace parse with new json parser
This commit is contained in:
parent
cf0da81e50
commit
b3a9867999
4
parse.go
4
parse.go
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/hcl/hcl/ast"
|
"github.com/hashicorp/hcl/hcl/ast"
|
||||||
hclParser "github.com/hashicorp/hcl/hcl/parser"
|
hclParser "github.com/hashicorp/hcl/hcl/parser"
|
||||||
"github.com/hashicorp/hcl/json"
|
jsonParser "github.com/hashicorp/hcl/json/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parse parses the given input and returns the root object.
|
// Parse parses the given input and returns the root object.
|
||||||
@ -16,7 +16,7 @@ func Parse(input string) (*ast.File, error) {
|
|||||||
case lexModeHcl:
|
case lexModeHcl:
|
||||||
return hclParser.Parse([]byte(input))
|
return hclParser.Parse([]byte(input))
|
||||||
case lexModeJson:
|
case lexModeJson:
|
||||||
return json.Parse(input)
|
return jsonParser.Parse([]byte(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("unknown config format")
|
return nil, fmt.Errorf("unknown config format")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user