Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci lint support #4519

Open
Danny5487401 opened this issue Dec 23, 2024 · 1 comment
Open

golangci lint support #4519

Danny5487401 opened this issue Dec 23, 2024 · 1 comment

Comments

@Danny5487401
Copy link

Danny5487401 commented Dec 23, 2024

@kevwan
suggest adding golangci lint in ci

reference

  1. https://github.com/go-kratos/kratos/blob/main/.golangci.yml
  2. https://github.com/gin-gonic/gin/blob/master/.golangci.yml
  3. https://github.com/cloudwego/kitex/blob/develop/.golangci.yaml
run:
  timeout: 5m
  modules-download-mode: readonly

linters:
  disable-all: true
  fast: false
  enable:
    - bodyclose
    - dogsled
    - durationcheck
    - errcheck
    # - copyloopvar # need upgrade to Go 1.22
    - govet
    - staticcheck
    - gosimple
    - gofmt
    - gofumpt
    - goconst
    - goimports
    - mnd
    - gocyclo
    - ineffassign
    - lll
    - prealloc
    - revive
    - staticcheck
    - typecheck
    - unused
    - whitespace
    - wastedassign
    - unconvert
    - misspell

  # don't enable:
  # - asciicheck
  # - scopelint
  # - gochecknoglobals
  # - gocognit
  # - godot
  # - godox
  # - goerr113
  # - interfacer
  # - maligned
  # - nestif
  # - prealloc
  # - testpackage
  # - stylecheck
  # - wsl

linters-settings:
  govet:
    enable:
      - shadow
  whitespace:
    multi-func: true
  lll:
    line-length: 160
  mnd:
    # don't include the "operation", "argument" and "assign"
    checks:
      - case
      - condition
      - return
  goconst:
    ignore-tests: true
  gocyclo:
    # recommend 10-20
    min-complexity: 50
  goimports:
    local-prefixes: github.com/zeromicro # Put imports beginning with prefix after 3rd-party packages
  misspell: # Finds commonly misspelled English words in comments
    locale: US
@kevwan
Copy link
Contributor

kevwan commented Dec 28, 2024

Would you please submit a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants