From 67d80a14459be69a53c0a39e1012288519540764 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 5 May 2023 09:51:42 +0200 Subject: [PATCH] chore: update linter --- .github/workflows/pr.yml | 2 +- .golangci.yml | 31 ++++++++++++++++++++++++++++++- certificate/errors.go | 2 +- challenge/resolver/errors.go | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0a4c9c7d..e92b3d87 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest env: GO_VERSION: '1.20' - GOLANGCI_LINT_VERSION: v1.51.2 + GOLANGCI_LINT_VERSION: v1.52.2 HUGO_VERSION: 0.54.0 CGO_ENABLED: 0 LEGO_E2E_TESTS: CI diff --git a/.golangci.yml b/.golangci.yml index e182de8f..dd07c95b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -46,6 +46,36 @@ linters-settings: - ruleguard - httpNoBody - exposedSyncMutex + revive: + rules: + - name: struct-tag + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: error-return + - name: error-strings + - name: error-naming + - name: exported + disabled: true + - name: if-return + - name: increment-decrement + - name: var-naming + - name: var-declaration + - name: package-comments + disabled: true + - name: range + - name: receiver-naming + - name: time-naming + - name: unexported-return + - name: indent-error-flow + - name: errorf + - name: empty-block + - name: superfluous-else + - name: unused-parameter + disabled: true + - name: unreachable-code + - name: redefines-builtin-id linters: enable-all: true @@ -103,7 +133,6 @@ issues: - 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked' - 'exported (type|method|function) (.+) should have comment or be unexported' - 'ST1000: at least one file in a package should have a package comment' - - 'package-comments: should have a package comment' exclude-rules: - path: (.+)_test.go linters: diff --git a/certificate/errors.go b/certificate/errors.go index 3adbc783..e0f283ba 100644 --- a/certificate/errors.go +++ b/certificate/errors.go @@ -19,7 +19,7 @@ func (e obtainError) Error() string { sort.Strings(domains) for _, domain := range domains { - buffer.WriteString(fmt.Sprintf("[%s] %s\n", domain, e[domain])) + _, _ = fmt.Fprintf(buffer, "[%s] %s\n", domain, e[domain]) } return buffer.String() } diff --git a/challenge/resolver/errors.go b/challenge/resolver/errors.go index e9da1ebf..94ccbd76 100644 --- a/challenge/resolver/errors.go +++ b/challenge/resolver/errors.go @@ -19,7 +19,7 @@ func (e obtainError) Error() string { sort.Strings(domains) for _, domain := range domains { - buffer.WriteString(fmt.Sprintf("[%s] %s\n", domain, e[domain])) + _, _ = fmt.Fprintf(buffer, "[%s] %s\n", domain, e[domain]) } return buffer.String() }