Fixed go vet errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Piotr Biernat 2023-04-04 01:08:01 +02:00
parent ad87dd53d8
commit 50ffd267f3
2 changed files with 6 additions and 6 deletions

View File

@ -169,7 +169,7 @@ func main() {
basket, err := ui.AddProductToBasket(basketSrv, productID, qty, basketID, reqID) basket, err := ui.AddProductToBasket(basketSrv, productID, qty, basketID, reqID)
if err == nil { 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): case strings.Contains(eName, event.EVENT_PRODUCT_REMOVED_FROM_BASKET):
productID := int(data["product_id"].(float64)) productID := int(data["product_id"].(float64))
@ -177,7 +177,7 @@ func main() {
basket, err := ui.RemoveProductFromBasket(basketSrv, productID, qty, basketID, reqID) basket, err := ui.RemoveProductFromBasket(basketSrv, productID, qty, basketID, reqID)
if err == nil { 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)
} }
} }

View File

@ -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... // @Refactor make single func with error message and optional http status code...
func (s *Server) Error400(c *fiber.Ctx, msg string) error { 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 // test with &(reference) before http.ErrorMessage, but probably it's gonna be erroneous
} }
func (s *Server) Error401(c *fiber.Ctx, msg string) error { 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 { 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 { 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 // @EndRefactor