mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-06 23:31:55 +00:00
ci: Update golangci-lint to v1.55.2 (#2817)
ci: bump golangci-lint to 1.55.2
This commit is contained in:
parent
455405c0f2
commit
ccf16117c0
2
.github/workflows/linter.yml
vendored
2
.github/workflows/linter.yml
vendored
@ -26,4 +26,4 @@ jobs:
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
# NOTE: Keep this in sync with the version from .golangci.yml
|
||||
version: v1.51.0
|
||||
version: v1.55.2
|
||||
|
@ -39,18 +39,20 @@ linters-settings:
|
||||
extra-rules: true
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G104
|
||||
config:
|
||||
global:
|
||||
audit: true
|
||||
|
||||
depguard:
|
||||
include-go-root: true
|
||||
packages:
|
||||
- flag
|
||||
- io/ioutil
|
||||
packages-with-error-message:
|
||||
- flag: '`flag` package is only allowed in main.go'
|
||||
- io/ioutil: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
|
||||
rules:
|
||||
main:
|
||||
deny:
|
||||
- pkg: flag
|
||||
desc: '`flag` package is only allowed in main.go'
|
||||
- pkg: io/ioutil
|
||||
desc: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
|
||||
|
||||
govet:
|
||||
check-shadowing: true
|
||||
@ -93,6 +95,8 @@ linters-settings:
|
||||
disabled: true
|
||||
- name: cognitive-complexity
|
||||
disabled: true
|
||||
- name: comment-spacings
|
||||
disabled: true # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- name: cyclomatic
|
||||
disabled: true
|
||||
- name: early-return
|
||||
@ -100,6 +104,8 @@ linters-settings:
|
||||
disabled: true
|
||||
- name: exported
|
||||
disabled: true
|
||||
arguments:
|
||||
- disableStutteringCheck # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- name: file-header
|
||||
disabled: true
|
||||
- name: function-result-limit
|
||||
@ -116,6 +122,8 @@ linters-settings:
|
||||
disabled: true
|
||||
- name: package-comments
|
||||
disabled: true
|
||||
- name: unchecked-type-assertion
|
||||
disabled: true # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
|
||||
stylecheck:
|
||||
checks:
|
||||
@ -164,7 +172,8 @@ linters:
|
||||
- exportloopref
|
||||
- forbidigo
|
||||
- forcetypeassert
|
||||
- goconst
|
||||
# - gochecksumtype # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
# - goconst # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- gocritic
|
||||
- gofmt
|
||||
- gofumpt
|
||||
@ -173,9 +182,12 @@ linters:
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
# - gosmopolitan # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- govet
|
||||
- grouper
|
||||
# - inamedparam # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- loggercheck
|
||||
# - mirror # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- misspell
|
||||
- nakedret
|
||||
- nilerr
|
||||
@ -184,6 +196,7 @@ linters:
|
||||
- nolintlint
|
||||
- nonamedreturns
|
||||
- nosprintfhostport
|
||||
# - perfsprint # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- predeclared
|
||||
- promlinter
|
||||
- reassign
|
||||
@ -192,7 +205,9 @@ linters:
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- stylecheck
|
||||
# - tagalign # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- tagliatelle
|
||||
- testifylint
|
||||
# - testpackage # TODO: Enable once https://github.com/gofiber/fiber/issues/2252 is implemented
|
||||
- thelper
|
||||
- tparallel
|
||||
@ -201,7 +216,7 @@ linters:
|
||||
- unparam
|
||||
- unused
|
||||
- usestdlibvars
|
||||
- wastedassign
|
||||
# - wastedassign # TODO https://github.com/gofiber/fiber/issues/2816
|
||||
- whitespace
|
||||
- wrapcheck
|
||||
- tenv
|
||||
|
@ -136,7 +136,7 @@ func parseParamSquareBrackets(k string) (string, error) {
|
||||
for i, b := range kbytes {
|
||||
if b == '[' && kbytes[i+1] != ']' {
|
||||
if err := bb.WriteByte('.'); err != nil {
|
||||
return "", err //nolint:wrapchec,wrapcheck // unnecessary to wrap it
|
||||
return "", err //nolint:wrapcheck // unnecessary to wrap it
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ func parseParamSquareBrackets(k string) (string, error) {
|
||||
}
|
||||
|
||||
if err := bb.WriteByte(b); err != nil {
|
||||
return "", err //nolint:wrapchec,wrapcheck // unnecessary to wrap it
|
||||
return "", err //nolint:wrapcheck // unnecessary to wrap it
|
||||
}
|
||||
}
|
||||
|
||||
|
28
error.go
28
error.go
@ -1,19 +1,19 @@
|
||||
package fiber
|
||||
|
||||
import (
|
||||
errors "encoding/json"
|
||||
stdErrors "errors"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/gofiber/fiber/v3/internal/schema"
|
||||
)
|
||||
|
||||
// Wrap and return this for unreachable code if panicking is undesirable (i.e., in a handler).
|
||||
// Unexported because users will hopefully never need to see it.
|
||||
var errUnreachable = stdErrors.New("fiber: unreachable code, please create an issue at github.com/gofiber/fiber")
|
||||
var errUnreachable = errors.New("fiber: unreachable code, please create an issue at github.com/gofiber/fiber")
|
||||
|
||||
// Graceful shutdown errors
|
||||
var (
|
||||
ErrGracefulTimeout = stdErrors.New("shutdown: graceful timeout has been reached, exiting")
|
||||
ErrGracefulTimeout = errors.New("shutdown: graceful timeout has been reached, exiting")
|
||||
)
|
||||
|
||||
// Fiber redirection errors
|
||||
@ -23,17 +23,17 @@ var (
|
||||
|
||||
// Range errors
|
||||
var (
|
||||
ErrRangeMalformed = stdErrors.New("range: malformed range header string")
|
||||
ErrRangeUnsatisfiable = stdErrors.New("range: unsatisfiable range")
|
||||
ErrRangeMalformed = errors.New("range: malformed range header string")
|
||||
ErrRangeUnsatisfiable = errors.New("range: unsatisfiable range")
|
||||
)
|
||||
|
||||
// Binder errors
|
||||
var ErrCustomBinderNotFound = stdErrors.New("binder: custom binder not found, please be sure to enter the right name")
|
||||
var ErrCustomBinderNotFound = errors.New("binder: custom binder not found, please be sure to enter the right name")
|
||||
|
||||
// Format errors
|
||||
var (
|
||||
// ErrNoHandlers is returned when c.Format is called with no arguments.
|
||||
ErrNoHandlers = stdErrors.New("format: at least one handler is required, but none were set")
|
||||
ErrNoHandlers = errors.New("format: at least one handler is required, but none were set")
|
||||
)
|
||||
|
||||
// gorilla/schema errors
|
||||
@ -52,21 +52,21 @@ type (
|
||||
type (
|
||||
// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
|
||||
// (The argument to Unmarshal must be a non-nil pointer.)
|
||||
InvalidUnmarshalError = errors.InvalidUnmarshalError
|
||||
InvalidUnmarshalError = json.InvalidUnmarshalError
|
||||
|
||||
// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method.
|
||||
MarshalerError = errors.MarshalerError
|
||||
MarshalerError = json.MarshalerError
|
||||
|
||||
// A SyntaxError is a description of a JSON syntax error.
|
||||
SyntaxError = errors.SyntaxError
|
||||
SyntaxError = json.SyntaxError
|
||||
|
||||
// An UnmarshalTypeError describes a JSON value that was
|
||||
// not appropriate for a value of a specific Go type.
|
||||
UnmarshalTypeError = errors.UnmarshalTypeError
|
||||
UnmarshalTypeError = json.UnmarshalTypeError
|
||||
|
||||
// An UnsupportedTypeError is returned by Marshal when attempting
|
||||
// to encode an unsupported value type.
|
||||
UnsupportedTypeError = errors.UnsupportedTypeError
|
||||
UnsupportedTypeError = json.UnsupportedTypeError
|
||||
|
||||
UnsupportedValueError = errors.UnsupportedValueError
|
||||
UnsupportedValueError = json.UnsupportedValueError
|
||||
)
|
||||
|
@ -76,7 +76,7 @@ func Test_HTTPHandler(t *testing.T) {
|
||||
req.Header.SetMethod(expectedMethod)
|
||||
req.SetRequestURI(expectedRequestURI)
|
||||
req.Header.SetHost(expectedHost)
|
||||
req.BodyWriter().Write([]byte(expectedBody)) //nolint:errcheck, gosec // not needed
|
||||
req.BodyWriter().Write([]byte(expectedBody)) //nolint:errcheck // not needed
|
||||
for k, v := range expectedHeader {
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ func Benchmark_Redirect_Route(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
c.Redirect().Route("user", RedirectConfig{ //nolint:errcheck,gosec,revive // we don't need to handle error here
|
||||
c.Redirect().Route("user", RedirectConfig{ //nolint:errcheck,revive // we don't need to handle error here
|
||||
Params: Map{
|
||||
"name": "fiber",
|
||||
},
|
||||
@ -366,7 +366,7 @@ func Benchmark_Redirect_Route_WithQueries(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
c.Redirect().Route("user", RedirectConfig{ //nolint:errcheck,gosec,revive // we don't need to handle error here
|
||||
c.Redirect().Route("user", RedirectConfig{ //nolint:errcheck,revive // we don't need to handle error here
|
||||
Params: Map{
|
||||
"name": "fiber",
|
||||
},
|
||||
@ -395,7 +395,7 @@ func Benchmark_Redirect_Route_WithFlashMessages(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
c.Redirect().With("success", "1").With("message", "test").Route("user") //nolint:errcheck,gosec,revive // we don't need to handle error here
|
||||
c.Redirect().With("success", "1").With("message", "test").Route("user") //nolint:errcheck,revive // we don't need to handle error here
|
||||
}
|
||||
|
||||
require.Equal(b, 302, c.Response().StatusCode())
|
||||
|
Loading…
x
Reference in New Issue
Block a user