diff --git a/compose_format/__init__.py b/compose_format/__init__.py index 4a5b8d4..9f54a19 100755 --- a/compose_format/__init__.py +++ b/compose_format/__init__.py @@ -87,6 +87,8 @@ def order(item): return sorted([ComposeFormat.reorder(item, strict=strict) for item in data]) if len(str(data)) >= 1 and str(data)[0].isdigit(): return '\'{0}\''.format(data) + if str(data).startswith('{'): + return '\'{0}\''.format(data) return data @staticmethod diff --git a/features/format.feature b/features/format.feature index a480d55..d686986 100644 --- a/features/format.feature +++ b/features/format.feature @@ -187,3 +187,22 @@ Feature: Format bbb: unknown ccc: unknown """ + + Scenario: Objects with Go Format Strings + Given a file named "compose.yml" with: + """ + foo: + image: bar + logging: + options: + tag: "{{.Name}}" + """ + When I run `bin/compose_format --non_strict compose.yml` + Then it should pass with exactly: + """ + foo: + image: bar + logging: + options: + tag: '{{.Name}}' + """