fix: use the default binding of gin

This commit is contained in:
zhuyasen 2025-05-11 22:36:28 +08:00
parent fa5e1921ce
commit 07f23f7b14
3 changed files with 0 additions and 13 deletions

View File

@ -12,11 +12,9 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-dev-frame/sponge/pkg/gin/handlerfunc"
"github.com/go-dev-frame/sponge/pkg/gin/middleware"
"github.com/go-dev-frame/sponge/pkg/gin/validator"
"github.com/go-dev-frame/sponge/pkg/logger"
)
@ -36,7 +34,6 @@ func NewRouter(spongeAddr string, isLog bool) *gin.Engine {
if isLog {
r.Use(middleware.Logging(middleware.WithLog(logger.Get())))
}
binding.Validator = validator.Init()
// solve vue using history route 404 problem
r.NoRoute(handlerfunc.BrowserRefreshFS(staticFS, "static/index.html"))

View File

@ -7,7 +7,6 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
@ -16,7 +15,6 @@ import (
"github.com/go-dev-frame/sponge/pkg/gin/middleware"
"github.com/go-dev-frame/sponge/pkg/gin/middleware/metrics"
"github.com/go-dev-frame/sponge/pkg/gin/prof"
"github.com/go-dev-frame/sponge/pkg/gin/validator"
"github.com/go-dev-frame/sponge/pkg/logger"
"github.com/go-dev-frame/sponge/docs"
@ -80,9 +78,6 @@ func NewRouter() *gin.Engine {
prof.Register(r, prof.WithIOWaitTime())
}
// validator
binding.Validator = validator.Init()
r.GET("/health", handlerfunc.CheckHealth)
r.GET("/ping", handlerfunc.Ping)
r.GET("/codes", handlerfunc.ListCodes)

View File

@ -6,7 +6,6 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-dev-frame/sponge/pkg/errcode"
"github.com/go-dev-frame/sponge/pkg/gin/handlerfunc"
@ -14,7 +13,6 @@ import (
"github.com/go-dev-frame/sponge/pkg/gin/middleware/metrics"
"github.com/go-dev-frame/sponge/pkg/gin/prof"
"github.com/go-dev-frame/sponge/pkg/gin/swagger"
"github.com/go-dev-frame/sponge/pkg/gin/validator"
"github.com/go-dev-frame/sponge/pkg/logger"
"github.com/go-dev-frame/sponge/docs"
@ -84,9 +82,6 @@ func NewRouter_pbExample() *gin.Engine { //nolint
prof.Register(r, prof.WithIOWaitTime())
}
// validator
binding.Validator = validator.Init()
r.GET("/health", handlerfunc.CheckHealth)
r.GET("/ping", handlerfunc.Ping)
r.GET("/codes", handlerfunc.ListCodes)