From f366e1d936559722a9014281b46be54598eae920 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sat, 4 Jun 2022 19:53:22 +0800 Subject: [PATCH] chore: make print pretty (#1967) --- rest/engine.go | 3 ++- rest/server_test.go | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rest/engine.go b/rest/engine.go index fad45771..224c5906 100644 --- a/rest/engine.go +++ b/rest/engine.go @@ -196,8 +196,9 @@ func (ng *engine) print() { sort.Strings(routes) + fmt.Println("routes:") for _, route := range routes { - fmt.Println(route) + fmt.Printf(" %s\n", route) } } diff --git a/rest/server_test.go b/rest/server_test.go index 06dd6d13..98f37736 100644 --- a/rest/server_test.go +++ b/rest/server_test.go @@ -350,10 +350,11 @@ func TestServer_PrintRoutes(t *testing.T) { Name: foo Port: 54321 ` - expect = `GET /bar -GET /foo -GET /foo/:bar -GET /foo/:bar/baz + expect = `routes: + GET /bar + GET /foo + GET /foo/:bar + GET /foo/:bar/baz ` )