Use short syntax for errcheck where possible

This commit is contained in:
Jan Bader 2022-02-20 16:51:28 +00:00
parent 9b92e2b551
commit 1a1971246d
2 changed files with 3 additions and 4 deletions

View File

@ -14,8 +14,7 @@ type newBudgetInformation struct {
func (h *Handler) newBudget(c *gin.Context) {
var newBudget newBudgetInformation
err := c.BindJSON(&newBudget)
if err != nil {
if err := c.BindJSON(&newBudget); err != nil {
c.AbortWithError(http.StatusNotAcceptable, err)
return
}

View File

@ -27,8 +27,8 @@ type Handler struct {
func (h *Handler) Serve() {
router := gin.Default()
h.LoadRoutes(router)
err := router.Run(":1323")
if err != nil {
if err := router.Run(":1323"); err != nil {
panic(err)
}
}