Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
simongottschlag committed Mar 8, 2024
1 parent dc545fa commit f317382
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.51.1
version: v1.56.2

fmt:
runs-on: ubuntu-latest
Expand Down
8 changes: 7 additions & 1 deletion go.work.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/cristalhq/aconfig v0.16.8 h1:lg8i0XHgfhvsnjNM5q/ou6jIHDRXlbBybjRP9t2fWuw=
github.com/cristalhq/aconfig v0.16.8/go.mod h1:NXaRp+1e6bkO4dJn+wZ71xyaihMDYPtCSvEhMTm/H3E=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand All @@ -14,8 +14,12 @@ github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNa
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/valyala/fasthttp v1.41.0/go.mod h1:f6VbjjoI3z1NDOZOv17o6RvtRSWxC77seBFc2uWtgiY=
Expand All @@ -25,6 +29,7 @@ github.com/xenitab/go-oidc-middleware v0.0.33/go.mod h1:0TK8rKoVii+Z7iRdDvL1s2aN
github.com/xenitab/go-oidc-middleware/oidcechojwt v0.0.28/go.mod h1:SzCZBr0zP5VJGt2AgHyYtdgQdN+rce0ImUIUgwCx2gk=
github.com/xenitab/go-oidc-middleware/oidcfiber v0.0.28/go.mod h1:gAZ4aymsh5I/A+vkapv5G3fnHyy51DKmOPZplFHWSw0=
github.com/xenitab/go-oidc-middleware/oidcgin v0.0.28/go.mod h1:N9aQNc16SAdLpb20MjzXzgo9TNuuyCuTUKXGkD1kXBI=
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand All @@ -49,3 +54,4 @@ golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxb
golang.org/x/time v0.0.0-20220411224347-583f2d630306 h1:+gHMid33q6pen7kv9xvT+JRinntgeXO2AeZVd0AWD3w=
golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
4 changes: 2 additions & 2 deletions oidcfiber/fiber.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ func onError(c *fiber.Ctx, errorHandler options.ErrorHandler, statusCode int, de
if errorHandler == nil {
return c.SendStatus(statusCode)
}
url, _ := url.Parse(c.OriginalURL())
parsedUrl, _ := url.Parse(c.OriginalURL()) //nolint: errcheck // not sure what to do with the error here
oidcErr := options.OidcError{
Url: url,
Url: parsedUrl,
Headers: c.GetReqHeaders(),
Status: description,
Error: err,
Expand Down
4 changes: 3 additions & 1 deletion oidcgin/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func onError(c *gin.Context, errorHandler options.ErrorHandler, statusCode int,
c.Header(k, v)
}
c.Data(response.StatusCode, response.ContentType(), response.Body)
c.Error(err)
c.Error(err) //nolint: errcheck // not sure what to do with the error here
c.Abort()
return nil
}
Expand All @@ -52,12 +52,14 @@ func toGinHandler[T any](parseToken oidc.ParseTokenFunc[T], setters ...options.O

tokenString, err := oidc.GetTokenString(c.Request.Header.Get, opts.TokenString)
if err != nil {
//nolint: errcheck // not sure what to do with the error here
onError(c, opts.ErrorHandler, http.StatusBadRequest, options.GetTokenErrorDescription, err)
return
}

claims, err := parseToken(ctx, tokenString)
if err != nil {
//nolint: errcheck // not sure what to do with the error here
onError(c, opts.ErrorHandler, http.StatusUnauthorized, options.ParseTokenErrorDescription, err)
return
}
Expand Down
4 changes: 2 additions & 2 deletions oidchttp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func New[T any](h http.Handler, claimsValidationFn options.ClaimsValidationFn[T]
return toHttpHandler(h, oidcHandler.ParseToken, setters...)
}

func onError(r *http.Request, w http.ResponseWriter, errorHandler options.ErrorHandler, statusCode int, description options.ErrorDescription, err error) {
func onError(r *http.Request, w http.ResponseWriter, errorHandler options.ErrorHandler, statusCode int, description options.ErrorDescription, err error) { //nolint: lll // nothing to do about the length
if errorHandler == nil {
w.WriteHeader(statusCode)
return
Expand All @@ -41,7 +41,7 @@ func onError(r *http.Request, w http.ResponseWriter, errorHandler options.ErrorH
}
w.Header().Set("Content-Type", response.ContentType())
w.WriteHeader(response.StatusCode)
w.Write(response.Body)
w.Write(response.Body) //nolint: errcheck // not sure what to do with the error here
}

func toHttpHandler[T any](h http.Handler, parseToken oidc.ParseTokenFunc[T], setters ...options.Option) http.Handler {
Expand Down

0 comments on commit f317382

Please sign in to comment.