Skip to content

Commit

Permalink
Linted
Browse files Browse the repository at this point in the history
  • Loading branch information
ainsleyclark committed Jun 23, 2021
1 parent b1df688 commit b73956e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/database/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (m *MySQL) Dump(path, filename string) error {
return &errors.Error{Code: errors.INVALID, Message: "Error writing SQL to file with the path: " + p, Operation: op, Err: err}
}

err = ioutil.WriteFile(p, bytes, 0644)
err = ioutil.WriteFile(p, bytes, os.ModePerm)
if err != nil {
return &errors.Error{Code: errors.INVALID, Message: "No file or directory with the path: " + p, Operation: op, Err: err}
}
Expand Down
2 changes: 1 addition & 1 deletion api/http/handler/api/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (a *Auth) Login(ctx *gin.Context) {

user.HidePassword()

ctx.SetCookie("verbis-session", user.Token, 172800, "/", "", false, true)
ctx.SetCookie("verbis-session", user.Token, 172800, "/", "", false, true) //nolint

api.Respond(ctx, http.StatusOK, "Successfully logged in & session started", user)
}
2 changes: 1 addition & 1 deletion api/http/handler/api/redirects/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (r *Redirects) Update(ctx *gin.Context) {
return
}

id, err := strconv.ParseInt(ctx.Param("id"), 10, 64)
id, err := strconv.ParseInt(ctx.Param("id"), 10, 64) //nolint
if err != nil {
api.Respond(ctx, http.StatusBadRequest, "A valid ID is required to update the redirect", &errors.Error{Code: errors.INVALID, Err: err, Operation: op})
return
Expand Down
6 changes: 3 additions & 3 deletions api/http/middleware/tokencheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func AdminTokenCheck(d *deps.Deps) gin.HandlerFunc {
if u.Role.Id > 1 {
g.Next()
} else {
api.AbortJSON(g, 403, "You must have access level of administrator to access this endpoint.", nil)
api.AbortJSON(g, http.StatusForbidden, "You must have access level of administrator to access this endpoint.", nil)
return
}
}
Expand All @@ -50,7 +50,7 @@ func OperatorTokenCheck(d *deps.Deps) gin.HandlerFunc {
if u.Role.Id > 0 {
g.Next()
} else {
api.AbortJSON(g, 403, "You must have access level of operator to access this endpoint.", nil)
api.AbortJSON(g, http.StatusForbidden, "You must have access level of operator to access this endpoint.", nil)
return
}
}
Expand Down Expand Up @@ -94,7 +94,7 @@ func checkUserToken(d *deps.Deps, g *gin.Context) (*domain.User, error) {
}

if u.Role.Id == domain.BannedRoleID {
api.AbortJSON(g, 403, "Your account has been suspended by the administration team", nil)
api.AbortJSON(g, http.StatusForbidden, "Your account has been suspended by the administration team", nil)
return &domain.User{}, err
}

Expand Down
2 changes: 1 addition & 1 deletion api/publisher/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *headers) Cache(g *gin.Context) {
if extension == "."+v {
cache := ""
if request == "max-age" || request == "min-fresh" || request == "max-stale" {
cache = fmt.Sprintf("%s=%s, %s", request, strconv.FormatInt(expiration, 10), "public")
cache = fmt.Sprintf("%s=%s, %s", request, strconv.FormatInt(expiration, 10), "public") //nolint
} else {
cache = request
}
Expand Down

0 comments on commit b73956e

Please sign in to comment.