From 9c274d3a07c1345abc97bdff372434bfaa644471 Mon Sep 17 00:00:00 2001 From: itchyny Date: Sun, 3 Mar 2019 23:31:57 +0900 Subject: [PATCH 1/2] add a newline after the open brace of map type --- printer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/printer.go b/printer.go index b68615c..c7adee9 100644 --- a/printer.go +++ b/printer.go @@ -158,7 +158,7 @@ func (p *printer) printMap() { p.visited[p.value.Pointer()] = true if PrintMapTypes { - p.printf("%s{", p.typeString()) + p.printf("%s{\n", p.typeString()) } else { p.println("{") } From 5913a656747b89301e2d6d6feeb31261d609ccf7 Mon Sep 17 00:00:00 2001 From: itchyny Date: Sun, 3 Mar 2019 23:32:16 +0900 Subject: [PATCH 2/2] add test for printing a map --- printer_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/printer_test.go b/printer_test.go index cd2ada7..7558779 100644 --- a/printer_test.go +++ b/printer_test.go @@ -175,6 +175,16 @@ var ( } `, }, + { + map[string]interface{}{"foo": 10, "bar": map[int]int{20: 30}}, ` + [green]map[string]interface {}[reset]{ + [red][bold]"[reset][red]foo[reset][red][bold]"[reset]: [blue][bold]10[reset], + [red][bold]"[reset][red]bar[reset][red][bold]"[reset]: [green]map[int]int[reset]{ + [blue][bold]20[reset]: [blue][bold]30[reset], + }, + } + `, + }, } arr [3]int