Skip to content

Commit

Permalink
use different variable name so returned function would not accidental…
Browse files Browse the repository at this point in the history
…ly be able to use it in future and cause data race
  • Loading branch information
aldas committed Feb 21, 2023
1 parent 7c75310 commit ef4aea9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions middleware/csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
config.CookieSecure = true
}

extractors, err := CreateExtractors(config.TokenLookup)
if err != nil {
panic(err)
extractors, cErr := CreateExtractors(config.TokenLookup)
if cErr != nil {
panic(cErr)
}

return func(next echo.HandlerFunc) echo.HandlerFunc {
Expand Down
6 changes: 3 additions & 3 deletions middleware/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
config.ParseTokenFunc = config.defaultParseToken
}

extractors, err := createExtractors(config.TokenLookup, config.AuthScheme)
if err != nil {
panic(err)
extractors, cErr := createExtractors(config.TokenLookup, config.AuthScheme)
if cErr != nil {
panic(cErr)
}
if len(config.TokenLookupFuncs) > 0 {
extractors = append(config.TokenLookupFuncs, extractors...)
Expand Down
6 changes: 3 additions & 3 deletions middleware/key_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc {
panic("echo: key-auth middleware requires a validator function")
}

extractors, err := createExtractors(config.KeyLookup, config.AuthScheme)
if err != nil {
panic(err)
extractors, cErr := createExtractors(config.KeyLookup, config.AuthScheme)
if cErr != nil {
panic(cErr)
}

return func(next echo.HandlerFunc) echo.HandlerFunc {
Expand Down

0 comments on commit ef4aea9

Please sign in to comment.