1
0
mirror of https://codeberg.org/crowci/crow.git synced 2025-08-09 07:42:52 +03:00

Enable gocritic and don't ignore globally (#3159)

Use `nolint` directives instead.

From #2960
This commit is contained in:
qwerty287
2024-01-10 15:34:44 +01:00
committed by GitHub
parent aef3f8f3ef
commit 12c40eb957
34 changed files with 170 additions and 161 deletions

View File

@@ -32,13 +32,14 @@ func AuthorizeAgent(c *gin.Context) {
parsed, err := token.ParseRequest(c.Request, func(t *token.Token) (string, error) {
return secret, nil
})
if err != nil {
switch {
case err != nil:
c.String(500, "invalid or empty token. %s", err)
c.Abort()
} else if parsed.Kind != token.AgentToken {
case parsed.Kind != token.AgentToken:
c.String(403, "invalid token. please use an agent token")
c.Abort()
} else {
default:
c.Next()
}
}