Skip to content

Commit

Permalink
fix: Golang security checks by gosec #104
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Apr 23, 2023
1 parent 4b451d1 commit bd90d8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/gin-gonic/gin"
)

func Launch(port int, indent int, char string, fn func(s string, indent int, char string) (string, error)) {
func Launch(port int, indent int, char string, fn func(s string, indent int, char string) (string, error)) error {
gin.SetMode(gin.ReleaseMode)

router := gin.Default()
Expand All @@ -29,5 +29,5 @@ func Launch(port int, indent int, char string, fn func(s string, indent int, cha
c.Data(http.StatusOK, "text/javascript", CACHE_SCRIPT)
})

router.Run(fmt.Sprintf(":%d", port))
return router.Run(fmt.Sprintf(":%d", port))
}
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ func main() {

src, dest, indent, char, web, port := cmd.InitArgv()
if web {
server.Launch(port, indent, char, formatter.Formatter)
err := server.Launch(port, indent, char, formatter.Formatter)
if err != nil {
log.Fatal(err)
}
} else {
err := updater.UpdateConfInDir(src, dest, indent, char, formatter.Formatter)
if err != nil {
Expand Down

0 comments on commit bd90d8b

Please sign in to comment.