diff --git a/.env b/.env index 6c1c2a5a..7922de9f 100644 --- a/.env +++ b/.env @@ -7,7 +7,6 @@ GOTENBERG_USER_UID=1001 NOTO_COLOR_EMOJI_VERSION=v2.047 # See https://github.com/googlefonts/noto-emoji/releases. PDFTK_VERSION=v3.3.3 # See https://gitlab.com/pdftk-java/pdftk/-/releases - Binary package. PDFCPU_VERSION=v0.8.1 # See https://github.com/pdfcpu/pdfcpu/releases. -GOLANGCI_LINT_VERSION=v1.64.2 # See https://github.com/golangci/golangci-lint/releases. GOTENBERG_VERSION=snapshot DOCKERFILE=build/Dockerfile DOCKERFILE_CLOUDRUN=build/Dockerfile.cloudrun diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f22d22e3..4f527b85 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -31,7 +31,7 @@ jobs: - name: Run linters uses: golangci/golangci-lint-action@v6 with: - version: v1.64.2 + version: v2.0.2 lint-prettier: name: Lint non-Golang codebase diff --git a/.golangci.yml b/.golangci.yml index aad2389a..1108eb25 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,56 +1,65 @@ -linters-settings: - gci: - sections: - - standard - - default - - prefix(github.com/gotenberg/gotenberg/v8) - skip-generated: true - custom-order: true - +version: "2" +run: + issues-exit-code: 1 + tests: false linters: - disable-all: true + default: none enable: - asasalint - asciicheck - bidichk - bodyclose + - copyloopvar - decorder - dogsled - dupl - dupword - durationcheck - - copyloopvar - errcheck - errname - exhaustive - - gci - - gofmt - - goimports - - gofumpt - gosec - - gosimple - govet - - ineffassign - importas + - ineffassign - misspell - prealloc - promlinter - #- sloglint - staticcheck - testableexamples - tparallel - - typecheck - unconvert - unused - usetesting - wastedassign - whitespace - -run: - timeout: 5m - issues-exit-code: 1 - tests: false - -output: - print-issued-lines: true - print-linter-name: true + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofmt + - gofumpt + - goimports + settings: + gci: + sections: + - standard + - default + - prefix(github.com/gotenberg/gotenberg/v8) + custom-order: true + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index fc271957..8b2aa402 100644 --- a/Makefile +++ b/Makefile @@ -180,13 +180,9 @@ lint-prettier: ## Lint non-Golang codebase lint-todo: ## Find TODOs in Golang codebase golangci-lint run --no-config --disable-all --enable godox -# go install mvdan.cc/gofumpt@latest -# go install github.com/daixiang0/gci@latest .PHONY: fmt fmt: ## Format Golang codebase and "optimize" the dependencies - gofumpt -l -w . - gci write -s standard -s default -s "prefix(github.com/gotenberg/gotenberg/v8)" --skip-generated --skip-vendor --custom-order . - go mod tidy + golangci-lint fmt .PHONY: prettify prettify: ## Format non-Golang codebase diff --git a/pkg/modules/api/mocks.go b/pkg/modules/api/mocks.go index 6d6c2a5f..3cdb8307 100644 --- a/pkg/modules/api/mocks.go +++ b/pkg/modules/api/mocks.go @@ -83,7 +83,7 @@ func (ctx *ContextMock) SetLogger(logger *zap.Logger) { // ctx := &api.ContextMock{Context: &api.Context{}} // ctx.setEchoContext(c) func (ctx *ContextMock) SetEchoContext(c echo.Context) { - ctx.Context.echoCtx = c + ctx.echoCtx = c } // SetMkdirAll sets the [gotenberg.MkdirAll]. @@ -91,7 +91,7 @@ func (ctx *ContextMock) SetEchoContext(c echo.Context) { // ctx := &api.ContextMock{Context: &api.Context{}} // ctx.SetMkdirAll(mkdirAll) func (ctx *ContextMock) SetMkdirAll(mkdirAll gotenberg.MkdirAll) { - ctx.Context.mkdirAll = mkdirAll + ctx.mkdirAll = mkdirAll } // SetPathRename sets the [gotenberg.PathRename]. @@ -99,7 +99,7 @@ func (ctx *ContextMock) SetMkdirAll(mkdirAll gotenberg.MkdirAll) { // ctx := &api.ContextMock{Context: &api.Context{}} // ctx.setPathRename(rename) func (ctx *ContextMock) SetPathRename(rename gotenberg.PathRename) { - ctx.Context.pathRename = rename + ctx.pathRename = rename } // RouterMock is a mock for the [Router] interface.