From 50ffd267f378cf530c96133185a40949c4503e79 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Tue, 4 Apr 2023 01:08:01 +0200 Subject: [PATCH] Fixed go vet errors --- src/cmd/worker/main.go | 4 ++-- src/pkg/server/server.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cmd/worker/main.go b/src/cmd/worker/main.go index e0f985a..043b9d4 100644 --- a/src/cmd/worker/main.go +++ b/src/cmd/worker/main.go @@ -169,7 +169,7 @@ func main() { basket, err := ui.AddProductToBasket(basketSrv, productID, qty, basketID, reqID) if err == nil { - logger.Log("Product #%s added to basket #%s. ReqID: #%s", productID, basket.ID, reqID) + logger.Log("Product #%d added to basket #%s. ReqID: #%s", productID, basket.ID, reqID) } case strings.Contains(eName, event.EVENT_PRODUCT_REMOVED_FROM_BASKET): productID := int(data["product_id"].(float64)) @@ -177,7 +177,7 @@ func main() { basket, err := ui.RemoveProductFromBasket(basketSrv, productID, qty, basketID, reqID) if err == nil { - logger.Log("Product #%s removed from basket #%s. ReqID: #%s", productID, basket.ID, reqID) + logger.Log("Product #%d removed from basket #%s. ReqID: #%s", productID, basket.ID, reqID) } } diff --git a/src/pkg/server/server.go b/src/pkg/server/server.go index 10c7029..86bd22a 100644 --- a/src/pkg/server/server.go +++ b/src/pkg/server/server.go @@ -58,20 +58,20 @@ func (s *Server) GetRequestID(c *fiber.Ctx) (string, error) { // @Refactor make single func with error message and optional http status code... func (s *Server) Error400(c *fiber.Ctx, msg string) error { - return c.Status(fiber.StatusBadRequest).JSON(http.ErrorResponse{msg}) + return c.Status(fiber.StatusBadRequest).JSON(http.ErrorResponse{Error: msg}) // test with &(reference) before http.ErrorMessage, but probably it's gonna be erroneous } func (s *Server) Error401(c *fiber.Ctx, msg string) error { - return c.Status(fiber.StatusUnauthorized).JSON(http.ErrorResponse{msg}) + return c.Status(fiber.StatusUnauthorized).JSON(http.ErrorResponse{Error: msg}) } func (s *Server) Error403(c *fiber.Ctx, msg string) error { - return c.Status(fiber.StatusForbidden).JSON(http.ErrorResponse{msg}) + return c.Status(fiber.StatusForbidden).JSON(http.ErrorResponse{Error: msg}) } func (s *Server) Error404(c *fiber.Ctx, msg string) error { - return c.Status(fiber.StatusNotFound).JSON(http.ErrorResponse{msg}) + return c.Status(fiber.StatusNotFound).JSON(http.ErrorResponse{Error: msg}) } // @EndRefactor