From e62b38c1194278b964ae6758f35edfb6134e6191 Mon Sep 17 00:00:00 2001 From: William Date: Sat, 9 Oct 2021 16:44:40 +0800 Subject: [PATCH] Check flag before profiling --- cmd/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/main.go b/cmd/main.go index 4587ee1..2c705ed 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -48,6 +48,9 @@ func run(args []string) error { }, }, Before: func(c *cli.Context) error { + if !c.Bool("profile") { + return nil + } go func() { stdlog.Println("Starting pprof server at :6060") stdlog.Fatal(http.ListenAndServe(":6060", http.DefaultServeMux))