chore: bump golangci-lint to v1.58.0
This commit is contained in:
parent
68b715306d
commit
d05d7aaacb
|
@ -57,10 +57,12 @@ linters:
|
|||
- inamedparam
|
||||
- sloglint
|
||||
- revive
|
||||
- gomnd
|
||||
- mnd
|
||||
- forbidigo
|
||||
- copyloopvar
|
||||
- intrange
|
||||
- fatcontext
|
||||
- canonicalheader
|
||||
|
||||
linters-settings:
|
||||
gocyclo:
|
||||
|
@ -123,7 +125,7 @@ linters-settings:
|
|||
enable-all: true
|
||||
sloglint:
|
||||
attr-only: true
|
||||
gomnd:
|
||||
mnd:
|
||||
ignored-functions:
|
||||
- strconv.FormatInt
|
||||
- strconv.ParseInt
|
||||
|
@ -507,7 +509,7 @@ issues:
|
|||
text: add-constant
|
||||
- path: bun/migrations
|
||||
linters:
|
||||
- gochecknoinits
|
||||
- init
|
||||
- linters:
|
||||
- lll
|
||||
source: "^//go:generate "
|
||||
|
|
|
@ -6,7 +6,7 @@ repos:
|
|||
stages: [commit-msg]
|
||||
additional_dependencies: ["@commitlint/config-conventional"]
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v1.57.2
|
||||
rev: v1.58.0
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
- repo: https://github.com/hadolint/hadolint
|
||||
|
|
|
@ -42,7 +42,7 @@ steps:
|
|||
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
|
||||
lint:
|
||||
image: golangci/golangci-lint:v1.57
|
||||
image: golangci/golangci-lint:v1.58
|
||||
pull: true
|
||||
depends_on:
|
||||
- generate
|
||||
|
|
2
Makefile
2
Makefile
|
@ -16,7 +16,7 @@ install-git-hooks:
|
|||
.PHONY: install-golangci-lint
|
||||
install-golangci-lint:
|
||||
@echo "Installing github.com/golangci/golangci-lint..."
|
||||
@(test -f $(GOLANGCI_LINT_PATH) && echo "github.com/golangci/golangci-lint is already installed. Skipping...") || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.57.2
|
||||
@(test -f $(GOLANGCI_LINT_PATH) && echo "github.com/golangci/golangci-lint is already installed. Skipping...") || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.58.0
|
||||
|
||||
.PHONY: install-oapi-codegen
|
||||
install-oapi-codegen:
|
||||
|
|
|
@ -23,30 +23,30 @@ var (
|
|||
}
|
||||
dbFlagMaxIdleConns = &cli.IntFlag{
|
||||
Name: "db.maxIdleConns",
|
||||
Value: 2, //nolint:gomnd
|
||||
Value: 2, //nolint:mnd
|
||||
EnvVars: []string{"DB_MAX_IDLE_CONNS"},
|
||||
Usage: "https://pkg.go.dev/database/sql#DB.SetMaxIdleConns",
|
||||
}
|
||||
dbFlagMaxOpenConns = &cli.IntFlag{
|
||||
Name: "db.maxOpenConns",
|
||||
Value: runtime.NumCPU() * 4, //nolint:gomnd
|
||||
Value: runtime.NumCPU() * 4, //nolint:mnd
|
||||
EnvVars: []string{"DB_MAX_OPEN_CONNS"},
|
||||
Usage: "https://pkg.go.dev/database/sql#DB.SetMaxOpenConns",
|
||||
}
|
||||
dbFlagConnMaxLifetime = &cli.DurationFlag{
|
||||
Name: "db.connMaxLifetime",
|
||||
Value: 30 * time.Minute, //nolint:gomnd
|
||||
Value: 30 * time.Minute, //nolint:mnd
|
||||
EnvVars: []string{"DB_CONN_MAX_LIFETIME"},
|
||||
Usage: "https://pkg.go.dev/database/sql#DB.SetConnMaxLifetime",
|
||||
}
|
||||
dbFlagReadTimeout = &cli.DurationFlag{
|
||||
Name: "db.readTimeout",
|
||||
Value: 10 * time.Second, //nolint:gomnd
|
||||
Value: 10 * time.Second, //nolint:mnd
|
||||
EnvVars: []string{"DB_READ_TIMEOUT"},
|
||||
}
|
||||
dbFlagWriteTimeout = &cli.DurationFlag{
|
||||
Name: "db.writeTimeout",
|
||||
Value: 5 * time.Second, //nolint:gomnd
|
||||
Value: 5 * time.Second, //nolint:mnd
|
||||
EnvVars: []string{"DB_WRITE_TIMEOUT"},
|
||||
}
|
||||
dbFlags = []cli.Flag{
|
||||
|
|
|
@ -26,18 +26,18 @@ var (
|
|||
apiServerFlagPort = &cli.UintFlag{
|
||||
Name: "api.port",
|
||||
EnvVars: []string{"API_PORT"},
|
||||
Value: 9234, //nolint:gomnd
|
||||
Value: 9234, //nolint:mnd
|
||||
}
|
||||
apiServerFlagHandlerTimeout = &cli.DurationFlag{
|
||||
Name: "api.handlerTimeout",
|
||||
EnvVars: []string{"API_HANDLER_TIMEOUT"},
|
||||
Value: 5 * time.Second, //nolint:gomnd
|
||||
Value: 5 * time.Second, //nolint:mnd
|
||||
Usage: "https://pkg.go.dev/net/http#TimeoutHandler",
|
||||
}
|
||||
apiServerFlagReadTimeout = &cli.DurationFlag{
|
||||
Name: "api.readTimeout",
|
||||
EnvVars: []string{"API_READ_TIMEOUT"},
|
||||
Value: 5 * time.Second, //nolint:gomnd
|
||||
Value: 5 * time.Second, //nolint:mnd
|
||||
}
|
||||
apiServerFlagReadHeaderTimeout = &cli.DurationFlag{
|
||||
Name: "api.readHeaderTimeout",
|
||||
|
@ -47,17 +47,17 @@ var (
|
|||
apiServerFlagWriteTimeout = &cli.DurationFlag{
|
||||
Name: "api.writeTimeout",
|
||||
EnvVars: []string{"API_WRITE_TIMEOUT"},
|
||||
Value: 10 * time.Second, //nolint:gomnd
|
||||
Value: 10 * time.Second, //nolint:mnd
|
||||
}
|
||||
apiServerFlagIdleTimeout = &cli.DurationFlag{
|
||||
Name: "api.idleTimeout",
|
||||
EnvVars: []string{"API_IDLE_TIMEOUT"},
|
||||
Value: 180 * time.Second, //nolint:gomnd
|
||||
Value: 180 * time.Second, //nolint:mnd
|
||||
}
|
||||
apiServerFlagShutdownTimeout = &cli.DurationFlag{
|
||||
Name: "api.shutdownTimeout",
|
||||
EnvVars: []string{"API_SHUTDOWN_TIMEOUT"},
|
||||
Value: 10 * time.Second, //nolint:gomnd
|
||||
Value: 10 * time.Second, //nolint:mnd
|
||||
}
|
||||
apiServerFlagOpenAPIEnabled = &cli.BoolFlag{
|
||||
Name: "api.openApi.enabled",
|
||||
|
|
|
@ -20,7 +20,7 @@ var (
|
|||
}
|
||||
twSvcFlagTimeout = &cli.DurationFlag{
|
||||
Name: "tw.timeout",
|
||||
Value: 10 * time.Second, //nolint:gomnd
|
||||
Value: 10 * time.Second, //nolint:mnd
|
||||
EnvVars: []string{"TW_TIMEOUT"},
|
||||
Usage: "https://pkg.go.dev/net/http#Client.Timeout",
|
||||
}
|
||||
|
|
6
go.mod
6
go.mod
|
@ -26,7 +26,7 @@ require (
|
|||
github.com/uptrace/bun/driver/pgdriver v1.2.1
|
||||
github.com/uptrace/bun/driver/sqliteshim v1.2.1
|
||||
github.com/uptrace/bun/extra/bundebug v1.2.1
|
||||
github.com/urfave/cli/v2 v2.27.1
|
||||
github.com/urfave/cli/v2 v2.27.2
|
||||
go.uber.org/automaxprocs v1.5.3
|
||||
golang.org/x/sync v0.7.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
|
@ -40,7 +40,7 @@ require (
|
|||
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
|
||||
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
|
||||
github.com/containerd/continuity v0.3.0 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/docker/cli v20.10.17+incompatible // indirect
|
||||
github.com/docker/docker v20.10.7+incompatible // indirect
|
||||
|
@ -86,7 +86,7 @@ require (
|
|||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
|
||||
golang.org/x/crypto v0.21.0 // indirect
|
||||
golang.org/x/mod v0.16.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
|
|
12
go.sum
12
go.sum
|
@ -30,8 +30,8 @@ github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvA
|
|||
github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM=
|
||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
|
||||
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
|
@ -206,8 +206,8 @@ github.com/uptrace/bun/driver/sqliteshim v1.2.1/go.mod h1:oJtOPSCDdDHgNw/0jwIGr+
|
|||
github.com/uptrace/bun/extra/bundebug v1.2.1 h1:85MYpX3QESYI02YerKxUi1CD9mHuLrc2BXs1eOCtQus=
|
||||
github.com/uptrace/bun/extra/bundebug v1.2.1/go.mod h1:sfGKIi0HSGxsTC/sgIHGwpnYduHHYhdMeOIwurgSY+Y=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
|
||||
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
||||
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
|
||||
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
|
||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
||||
|
@ -220,8 +220,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
|
|||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
|
||||
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
|
||||
|
|
|
@ -47,7 +47,7 @@ func Logger(logger Slogger, opts ...Option) func(next http.Handler) http.Handler
|
|||
slog.String("httpRequest.ip", cfg.ipExtractor(r)),
|
||||
slog.Int("httpResponse.status", status),
|
||||
slog.Int("httpResponse.bytes", ww.BytesWritten()),
|
||||
//nolint:gomnd
|
||||
//nolint:mnd
|
||||
slog.Float64("httpResponse.duration", float64(end.Sub(start).Nanoseconds())/1000000.0), // in milliseconds
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue