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
50 changes: 50 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
cache: false
go-version: '1.23'
- uses: actions/checkout@v4
- name: Run linter with GH action
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.64.8

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
args: --config ./golangcilint.yaml --exclude-files ./pkg/verity/verity.go --enable-all ./cmd/... ./pkg/...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you comment on excluding verity.go ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see below related to cgo ... can we add that comment to the lint.yaml so we remember why?


# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true
# skip-pkg-cache: false

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
- name: Run linter from make target
run: |
make check
- name: Run log linter
run: |
make check-logs
75 changes: 75 additions & 0 deletions golangcilint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
run:
timeout: 60m

linters:
enable-all: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about not tweaking these? While I don't some of the defaults, it might be easier than keeping a list of what we don't want?

disable:
- gomnd
- funlen
- gocognit
- paralleltest
- forbidigo
- ireturn
- wrapcheck
- exhaustive
- maintidx
- exhaustruct
- rowserrcheck
- sqlclosecheck
- revive
- musttag
- depguard
- execinquery
- inamedparam
- intrange
- promlinter
- protogetter
- contextcheck # needs to revisit: https://github.com/project-zot/zot/pull/2556
- copyloopvar # needs to revisit: https://github.com/project-zot/zot/pull/2556
- typecheck
- exportloopref

linters-settings:
dupl:
threshold: 200
nestif:
min-complexity: 26
cyclop:
max-complexity: 40
skip-tests: true
varnamelen:
check-return: true
ignore-type-assert-ok: true
ignore-map-index-ok: true
ignore-chan-recv-ok: true
ignore-names:
- err
- ok
- gc
- wg
ignore-decls:
- n int
- i int
- r *os.File
- w *os.File
- to int64
gci:
sections:
- standard
- default
wsl:
allow-assign-and-anything: true
force-err-cuddling: true
nolintlint:
allow-unused: true
mnd:
checks:
- argument
- case
- condition
- operation
- return
- assign
ignored-numbers:
- "10"
- "64"
Loading