refactor: Fix linter errors by auto-apply

- Apply automated linter fixes
- Manually reformat fields in model/service.go
- Resolve code complexity issues
This commit is contained in:
2025-11-04 19:59:17 +03:00
parent 180a5c2a90
commit fc8b723114
11 changed files with 60 additions and 32 deletions

16
main.go
View File

@@ -27,16 +27,19 @@ func main() {
if appArgs.Migration != nil && appArgs.Migration.Create != nil {
runMigrationCreateCommand()
return
}
if appArgs.Server != nil {
runServerCommand()
return
}
if appArgs.Docs != nil {
runDocumentationCommand()
return
}
}
@@ -57,11 +60,13 @@ func runServerCommand() {
func runDocumentationCommand() {
if appArgs.Docs.Generate != nil {
runDocsGenerationCommand()
return
}
if appArgs.Docs.Serve != nil {
runDocsServingCommand()
return
}
}
@@ -70,6 +75,7 @@ func runDocsGenerationCommand() {
documentate, err := router.Documentate()
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
@@ -83,6 +89,7 @@ func runDocsGenerationCommand() {
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
@@ -90,14 +97,17 @@ func runDocsGenerationCommand() {
_, err = os.Stdout.Write(file)
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
return
}
err = os.WriteFile(appArgs.Docs.Generate.Out, file, os.ModeAppend)
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
}
@@ -106,18 +116,21 @@ func runDocsServingCommand() {
documentate, err := router.Documentate()
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
docsJson, err := documentate.MarshalJSON()
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
html, err := htmlFolder.ReadFile("html/redoc.html")
if err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
@@ -127,6 +140,7 @@ func runDocsServingCommand() {
_, err = c.Writer.Write(docsJson)
if err != nil {
c.Writer.WriteHeader(http.StatusInternalServerError)
return
}
})
@@ -136,12 +150,14 @@ func runDocsServingCommand() {
_, err = c.Writer.Write(html)
if err != nil {
c.Writer.WriteHeader(http.StatusInternalServerError)
return
}
})
if err = g.Run(fmt.Sprintf(":%s", appArgs.Docs.Serve.Port)); err != nil {
appLog.Global.Get(appLog.SYSTEM).Error(err)
return
}
}