diff --git a/internal/servants/docs.go b/internal/servants/docs.go deleted file mode 100644 index 9d53cac5..00000000 --- a/internal/servants/docs.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build !docs -// +build !docs - -package servants - -import ( - "github.com/gin-gonic/gin" -) - -// registerDocs stub function for register docs asset route -func registerDocs(e *gin.Engine) { - // empty -} diff --git a/internal/servants/docs/docs.go b/internal/servants/docs/docs.go new file mode 100644 index 00000000..ef062a47 --- /dev/null +++ b/internal/servants/docs/docs.go @@ -0,0 +1,13 @@ +//go:build !docs +// +build !docs + +package docs + +import ( + "github.com/gin-gonic/gin" +) + +// RegisterDocs stub function for register docs asset route +func RegisterDocs(e *gin.Engine) { + // empty +} diff --git a/internal/servants/docs_embed.go b/internal/servants/docs/docs_embed.go similarity index 72% rename from internal/servants/docs_embed.go rename to internal/servants/docs/docs_embed.go index 1d7efb0f..da457e50 100644 --- a/internal/servants/docs_embed.go +++ b/internal/servants/docs/docs_embed.go @@ -1,7 +1,7 @@ //go:build docs // +build docs -package servants +package docs import ( "github.com/gin-gonic/gin" @@ -9,8 +9,8 @@ import ( "github.com/rocboss/paopao-ce/pkg/cfg" ) -// registerDocs register docs asset route -func registerDocs(e *gin.Engine) { +// RegisterDocs register docs asset route +func RegisterDocs(e *gin.Engine) { cfg.Be("Docs:OpenAPI", func() { e.StaticFS("/docs/openapi", openapi.NewFileSystem()) }) diff --git a/internal/servants/servants.go b/internal/servants/servants.go index c61dcc82..4c36c0d6 100644 --- a/internal/servants/servants.go +++ b/internal/servants/servants.go @@ -2,7 +2,9 @@ package servants import ( "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/servants/docs" "github.com/rocboss/paopao-ce/internal/servants/localoss" + "github.com/rocboss/paopao-ce/internal/servants/statick" "github.com/rocboss/paopao-ce/internal/servants/web" "github.com/rocboss/paopao-ce/pkg/cfg" ) @@ -11,8 +13,8 @@ import ( func RegisterWebServants(e *gin.Engine) { // 按需注册 docs、静态资源 { - registerDocs(e) - registerStatick(e) + docs.RegisterDocs(e) + statick.RegisterStatick(e) } web.RouteWeb(e) diff --git a/internal/servants/statick.go b/internal/servants/statick.go deleted file mode 100644 index d711dfe3..00000000 --- a/internal/servants/statick.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build !embed -// +build !embed - -package servants - -import ( - "github.com/gin-gonic/gin" -) - -// registerStatick stub function for register static asset route -func registerStatick(e *gin.Engine) { - // empty -} diff --git a/internal/servants/statick/statick.go b/internal/servants/statick/statick.go new file mode 100644 index 00000000..a852bdfc --- /dev/null +++ b/internal/servants/statick/statick.go @@ -0,0 +1,13 @@ +//go:build !embed +// +build !embed + +package statick + +import ( + "github.com/gin-gonic/gin" +) + +// RegisterStatick stub function for register static asset route +func RegisterStatick(e *gin.Engine) { + // empty +} diff --git a/internal/servants/statick_embed.go b/internal/servants/statick/statick_embed.go similarity index 82% rename from internal/servants/statick_embed.go rename to internal/servants/statick/statick_embed.go index de212e55..6dd4c77b 100644 --- a/internal/servants/statick_embed.go +++ b/internal/servants/statick/statick_embed.go @@ -1,7 +1,7 @@ //go:build embed // +build embed -package servants +package statick import ( "net/http" @@ -10,8 +10,8 @@ import ( "github.com/rocboss/paopao-ce/web" ) -// registerStatick register static assets route -func registerStatick(e *gin.Engine) { +// RegisterStatick register static assets route +func RegisterStatick(e *gin.Engine) { routeStatic(e, "/", "/index.html", "/favicon.ico", "/assets/*filepath") } diff --git a/internal/version/version.go b/internal/version/version.go deleted file mode 100644 index b3bcb903..00000000 --- a/internal/version/version.go +++ /dev/null @@ -1,8 +0,0 @@ -package version - -var ( - // GitHash Value will be set during build - GitHash = "" - // BuildTime Value will be set during build - BuildTime = "" -)