Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
version: latest

generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
terraform:
- 'latest'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
Expand Down
252 changes: 138 additions & 114 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
version: "2"

run:
timeout: 5m
modules-download-mode: readonly

linters: # 2022-07-21 modified
linters:
default: none
enable:
- asasalint
- asciicheck
Expand All @@ -14,17 +18,14 @@ linters: # 2022-07-21 modified
- errorlint
- exhaustive
- copyloopvar
- gci
- gochecknoglobals
- gochecknoinits
- gocognit # probably tune
- gocognit
- goconst
- gocritic # probably tune
- gocritic
- godot
- err113
- gofumpt
- gosec
# - ifshort # not yet mature, has some bugs
- lll
- makezero
- misspell
Expand All @@ -43,121 +44,144 @@ linters: # 2022-07-21 modified
- unconvert
- wastedassign
- whitespace
- wsl

linters-settings:
exhaustive:
default-signifies-exhaustive: true

gci:
sections:
- standard
- default
- prefix(gitlab.cdn77.eu)

govet:
enable-all: true
disable:
- shadow
- fieldalignment # @todo fix later

gosec:
excludes: [G501, G502, G503, G504, G505] # ignore imports, usages are still reported

revive: # v1.2.3
ignore-generated-header: true
confidence: 0.8
severity: error
- wsl_v5
- govet

settings:
exhaustive:
default-signifies-exhaustive: true

govet:
enable-all: true
disable:
- shadow
- fieldalignment # @todo fix later

gosec:
excludes: [G501, G502, G503, G504, G505] # ignore imports, usages are still reported

revive:
confidence: 0.8
severity: error
rules:
- name: atomic
- name: bare-return
- name: blank-imports
- name: bool-literal-in-expr
- name: confusing-naming
- name: confusing-results
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: datarace
- name: deep-exit
- name: defer
- name: dot-imports
- name: duplicated-imports
- name: early-return
- name: empty-block
- name: empty-lines
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: flag-parameter
- name: get-return
- name: identical-branches
- name: if-return
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
- name: modifies-parameter
- name: modifies-value-receiver
- name: range
- name: range-val-address
- name: range-val-in-closure
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: struct-tag
- name: superfluous-else
- name: time-equal
- name: time-naming
- name: unconditional-recursion
- name: unexported-naming
- name: unexported-return
- name: unnecessary-stmt
- name: unused-parameter
- name: unused-receiver
- name: use-any
- name: useless-break
- name: var-declaration
- name: waitgroup-by-value

lll:
tab-width: 4

wsl_v5:
allow-first-in-block: true
allow-whole-block: false
branch-max-lines: 2
disable:
- decl

exclusions:
paths:
- mocks
rules:
- name: atomic
- name: bare-return
- name: blank-imports
- name: bool-literal-in-expr
- name: confusing-naming
- name: confusing-results
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: datarace
- name: deep-exit
- name: defer
- name: dot-imports
- name: duplicated-imports
- name: early-return
- name: empty-block
- name: empty-lines
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: flag-parameter
- name: get-return
- name: identical-branches
- name: if-return
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
- name: modifies-parameter
- name: modifies-value-receiver
- name: range
- name: range-val-address
- name: range-val-in-closure
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: struct-tag
- name: superfluous-else
- name: time-equal
- name: time-naming
- name: unconditional-recursion
- name: unexported-naming
- name: unexported-return
- name: unnecessary-stmt
- name: unused-parameter
- name: unused-receiver
- name: use-any
- name: useless-break
- name: var-declaration
- name: waitgroup-by-value

lll:
tab-width: 4

wsl:
allow-cuddle-declarations: true
# ignore unchecked errors, missing Close(), code complexity, constant enforcement, global variables,
# line lengths and code duplicity in tests
- path: _test\.go
linters:
- errcheck
- bodyclose
- cyclop
- gocognit
- goconst
- gochecknoglobals
- lll
- dupl

issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs:
- mocks
exclude-rules:
# ignore unchecked errors, missing Close(), code complexity, constant enforcement, global variables,
# line lengths and code duplicity in tests
- path: _test\.go
linters: [errcheck, bodyclose, cyclop, gocognit, goconst, gochecknoglobals, lll, dupl]
# ignore control flags in tests
- path: _test\.go
# ignore control flags in tests
- path: _test\.go
text: seems to be a control flag, avoid control coupling
linters: [revive]
# ignore unchecked errors in defer statements
- source: "^\t+defer "

# ignore unchecked errors in defer statements
- source: "^\t+defer "
linters: [errcheck]
# ignore cuddle in tests
- path: _test\.go

# ignore cuddle in tests
- path: _test\.go
text: only one cuddle assignment allowed before defer statement
linters: [wsl]
# ignore expressions after assignment in tests
- path: _test\.go
linters: [wsl_v5]

# ignore expressions after assignment in tests
- path: _test\.go
text: only cuddled expressions if assigning variable or using from line above
linters: [wsl]
# ignore expressions and assignments cuddling in tests
- path: _test\.go
linters: [wsl_v5]

# ignore expressions and assignments cuddling in tests
- path: _test\.go
text: assignments should only be cuddled with other assignments
linters: [wsl]
# ignore err113 dynamic errors definition error...not sure how to approach this correctly now
- text: do not define dynamic errors, use wrapped static errors instead
linters: [wsl_v5]

# ignore err113 dynamic errors definition error...not sure how to approach this correctly now
- text: do not define dynamic errors, use wrapped static errors instead
linters: [err113]

output:
sort-results: true
issues:
max-issues-per-linter: 0
max-same-issues: 0

formatters:
enable:
- gci
- gofumpt
settings:
gci:
sections:
- standard
- default
- prefix(gitlab.cdn77.eu)

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANGCI_LINT ?= go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest
GOLANGCI_LINT ?= go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest

.PHONY: testacc
testacc: clearacc
Expand Down
Loading