Skip to content

Commit 7f13715

Browse files
committed
fixing { disapper at the end of line
1 parent a890a48 commit 7f13715

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

formatter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ func Format(template string, args ...any) string {
4444
if template[i] == '{' {
4545
// possibly it is a template placeholder
4646
if i == templateLen-1 {
47+
// if we gave { at the end of line i.e. -> type serviceHealth struct {,
48+
// without this write we got type serviceHealth struct
49+
formattedStr.WriteByte('{')
4750
break
4851
}
4952
// considering in 2 phases - {{ }}
@@ -156,6 +159,9 @@ func FormatComplex(template string, args map[string]any) string {
156159
if template[i] == '{' {
157160
// possibly it is a template placeholder
158161
if i == templateLen-1 {
162+
// if we gave { at the end of line i.e. -> type serviceHealth struct {,
163+
// without this write we got type serviceHealth struct
164+
formattedStr.WriteByte('{')
159165
break
160166
}
161167

0 commit comments

Comments
 (0)