From 0ab435a1b299010fa7f7603b92a0d9adbcd1dab3 Mon Sep 17 00:00:00 2001 From: linzhengen Date: Sun, 29 Dec 2024 13:45:45 +0900 Subject: [PATCH] chore: fix lint --- app/application/seed.go | 4 ++-- app/interfaces/api/gin.go | 6 +++--- configs/config.go | 2 +- pkg/logger/logger.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/application/seed.go b/app/application/seed.go index 35028dc..26a3793 100644 --- a/app/application/seed.go +++ b/app/application/seed.go @@ -120,8 +120,8 @@ func (s seedApp) createMenus(ctx context.Context, parentID string, list SeedMenu if err != nil { return err } - - if &item != nil && item.Children != nil && len(item.Children) > 0 { + _item := &item + if _item != nil && item.Children != nil && len(item.Children) > 0 { err := s.createMenus(ctx, menuID, item.Children) if err != nil { return err diff --git a/app/interfaces/api/gin.go b/app/interfaces/api/gin.go index 4d80f17..d80a273 100644 --- a/app/interfaces/api/gin.go +++ b/app/interfaces/api/gin.go @@ -53,21 +53,21 @@ func GetBody(c *gin.Context) []byte { func ParseJSON(c *gin.Context, obj interface{}) error { if err := c.ShouldBindJSON(obj); err != nil { - return errors2.Wrap400Response(err, "400 Bad Request - "+err.Error()) + return errors2.Wrap400Response(err, "400 Bad Request - %v", err) } return nil } func ParseQuery(c *gin.Context, obj interface{}) error { if err := c.ShouldBindQuery(obj); err != nil { - return errors2.Wrap400Response(err, "400 Bad Request - "+err.Error()) + return errors2.Wrap400Response(err, "400 Bad Request - %v", err) } return nil } func ParseForm(c *gin.Context, obj interface{}) error { if err := c.ShouldBindWith(obj, binding.Form); err != nil { - return errors2.Wrap400Response(err, "400 Bad Request - "+err.Error()) + return errors2.Wrap400Response(err, "400 Bad Request - %v", err) } return nil } diff --git a/configs/config.go b/configs/config.go index f55e398..33f969c 100644 --- a/configs/config.go +++ b/configs/config.go @@ -105,7 +105,7 @@ func (h LogHook) IsMongo() bool { } type Log struct { - Level int + Level uint32 Format string Output string OutputFile string diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index e0f1a03..38313c2 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -33,8 +33,8 @@ func StandardLogger() *Logger { return logrus.StandardLogger() } -func SetLevel(level int) { - logrus.SetLevel(logrus.Level(uint32(level))) +func SetLevel(level uint32) { + logrus.SetLevel(logrus.Level(level)) } func SetFormatter(format string) {