diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml new file mode 100644 index 0000000..cde0a7c --- /dev/null +++ b/.github/linters/.golangci.yml @@ -0,0 +1,51 @@ +linters-settings: + gci: + local-prefixes: github.com/foomo/keel + revive: + rules: + - name: indent-error-flow + disabled: true + gocritic: + enabled-tags: + - diagnostic + - performance + - style + disabled-tags: + - experimental + - opinionated + disabled-checks: + - ifElseChain + settings: + hugeParam: + sizeThreshold: 512 + +linters: + enable: + - bodyclose + - dogsled + - dupl + - exhaustive + - exportloopref + - gci + - goconst + - gocritic + - gocyclo + - gofmt + - goprintffuncname + - gosec + - ifshort + - misspell + - nakedret + - noctx + - nolintlint + - prealloc + - revive + - promlinter + - rowserrcheck + - sqlclosecheck + - stylecheck + - thelper + - tparallel + - unconvert + - unparam + - whitespace diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 030bb02..e94c34d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,14 +1,19 @@ +# This workflow runs all dockerfiles in this repo name: checks -on: [push, workflow_dispatch] +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: env: GO_VERSION: 1.17 GOLANGCI_LINT_VERSION: v1.43.0 jobs: - go-matrix: - name: Resolve Modules + go_matrix: + name: go matrix runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} @@ -19,11 +24,12 @@ jobs: matrix=$(find . -type f -name "go.mod" -printf "{\"folder\":\"%h\"}," | sed -e 's/,$//') echo "Matrix: $matrix" echo ::set-output name=matrix::{\"include\":[$(echo $matrix)]} - go-lint: - name: lint + go_lint: + name: go lint + needs: go_matrix runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.go-matrix.outputs.matrix) }} + matrix: ${{ fromJson(needs.go_matrix.outputs.matrix) }} env: GOFLAGS: -mod=readonly GOPROXY: https://proxy.golang.org diff --git a/.golangci.yml b/.golangci.yml index b3ac7bd..243989e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,15 +1,12 @@ +# Minimum golangci-lint version required: v1.42.0 run: - timeout: 5m + timeout: 3m skip-dirs: - tmp linters-settings: gci: local-prefixes: github.com/foomo/keel - golint: - min-confidence: 0 - goimports: - local-prefixes: github.com/foomo/keel revive: rules: - name: indent-error-flow @@ -27,70 +24,34 @@ linters-settings: settings: hugeParam: sizeThreshold: 512 - lll: - line-length: 150 linters: - disable-all: true enable: - bodyclose - - deadcode - dogsled - dupl - exhaustive - exportloopref - gci - goconst + - gocritic + - gocyclo - gofmt - - gofumpt - - goimports - - revive - goprintffuncname - - govet - - ineffassign + - gosec + - ifshort - misspell - nakedret - noctx - nolintlint - prealloc + - revive + - promlinter - rowserrcheck - sqlclosecheck - - staticcheck - - structcheck - stylecheck - - typecheck + - thelper + - tparallel - unconvert - unparam - - unused - - varcheck - whitespace - - errcheck - - gocritic - - gosimple - - - gocyclo - - gosec - - lll - - exportloopref - - # unused - # - godot - # - gocognit - # - nlreturn - # - gochecknoglobals - # - gochecknoinits - # - depguard - # - goheader - # - gomodguard - - # don't enable: - # - asciicheck - # - funlen - # - godox - # - goerr113 - # - gomnd - # - interfacer - # - maligned - # - nestif - # - testpackage - # - wsl