1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-07-12 22:21:40 +02: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

@ -29,15 +29,16 @@ import (
)
func handlePipelineErr(c *gin.Context, err error) {
if errors.Is(err, &pipeline.ErrNotFound{}) {
switch {
case errors.Is(err, &pipeline.ErrNotFound{}):
c.String(http.StatusNotFound, "%s", err)
} else if errors.Is(err, &pipeline.ErrBadRequest{}) {
case errors.Is(err, &pipeline.ErrBadRequest{}):
c.String(http.StatusBadRequest, "%s", err)
} else if errors.Is(err, pipeline.ErrFiltered) {
case errors.Is(err, pipeline.ErrFiltered):
// for debugging purpose we add a header
c.Writer.Header().Add("Pipeline-Filtered", "true")
c.Status(http.StatusNoContent)
} else {
default:
_ = c.AbortWithError(http.StatusInternalServerError, err)
}
}