From a40bb01769e95fd31176073f8fd6e6310dc330b4 Mon Sep 17 00:00:00 2001 From: Steve Engledow Date: Thu, 7 Mar 2019 12:03:08 -0800 Subject: [PATCH] Default to parsing as YAML unless the file is definitely JSON --- goformation.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/goformation.go b/goformation.go index 589f31ce08..2dbe0a3b65 100644 --- a/goformation.go +++ b/goformation.go @@ -27,12 +27,12 @@ func OpenWithOptions(filename string, options *intrinsics.ProcessorOptions) (*cl return nil, err } - if strings.HasSuffix(filename, ".yaml") || strings.HasSuffix(filename, ".yml") { - return ParseYAMLWithOptions(data, options) + if strings.HasSuffix(filename, ".json") { + // This is definitely JSON + return ParseJSONWithOptions(data, options) } - return ParseJSONWithOptions(data, options) - + return ParseYAMLWithOptions(data, options) } // ParseYAML an AWS CloudFormation template (expects a []byte of valid YAML)