From cbbbfedd615915c5ffc09fd644a787158d8ef866 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 11 Sep 2023 05:11:14 +0200 Subject: Run ‘go fmt’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- formatter/formatter.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/formatter/formatter.go b/formatter/formatter.go index af84ec3..6249c0a 100644 --- a/formatter/formatter.go +++ b/formatter/formatter.go @@ -14,11 +14,11 @@ var ( '&': "&", '<': "<", } - stringEscapes = map[rune]string { - '"': """, - '&': "&", - '<': "<", - '>': ">", + stringEscapes = map[rune]string{ + '"': """, + '&': "&", + '<': "<", + '>': ">", '\'': "'", } ) @@ -49,10 +49,10 @@ func PrintAst(ast parser.AstNode) { func printAttrs(attrs []parser.Attr) { classes := attrs - classes = slices.DeleteFunc(classes, func (a parser.Attr) bool { + classes = slices.DeleteFunc(classes, func(a parser.Attr) bool { return a.Key != "class" }) - attrs = slices.DeleteFunc(attrs, func (a parser.Attr) bool { + attrs = slices.DeleteFunc(attrs, func(a parser.Attr) bool { return a.Key == "class" }) @@ -60,7 +60,7 @@ func printAttrs(attrs []parser.Attr) { fmt.Print(" class=\"") for i, a := range classes { fmt.Print(a.Value) - if i != len(classes) - 1 { + if i != len(classes)-1 { fmt.Print(" ") } else { fmt.Print("\"") @@ -105,7 +105,7 @@ func printChildrenTrim(nodes []parser.AstNode) { if i == 0 && n.Type == parser.Text { n.Text = trimLeftSpaces(n.Text) } - if i == len(nodes) - 1 && n.Type == parser.Text { + if i == len(nodes)-1 && n.Type == parser.Text { n.Text = trimRightSpaces(n.Text) } -- cgit v1.2.3