From b1d2ba896c3f93468b8601c3ebb133575b219490 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 2 Jul 2024 20:13:36 +0400 Subject: [PATCH] refactor: move Sprintf-generation of `url` out of func args allows much better debugging + some readability --- server.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/server.go b/server.go index 1684d65..870aeba 100644 --- a/server.go +++ b/server.go @@ -58,17 +58,20 @@ func handler(ctx *fasthttp.RequestCtx) { bytes.Equal(scheme, []byte("https")), ) + urlToSearch := fmt.Sprintf( + "%s://%s:%s%s", + scheme, + host, + port, + ctx.RequestURI(), + ) row := stmt.QueryRow( string(ctx.Method()), - fmt.Sprintf( - "%s://%s:%s%s", - scheme, - host, - port, - ctx.RequestURI(), - ), + urlToSearch, ) + // log.Println(urlToSearch) + var id int var code int