version: "2"
linters:
  enable:
    - godot
    - misspell
    - revive
    - whitespace
  settings:
    errcheck:
      exclude-functions:
        - (io.ReadCloser).Close
        - (io.WriteCloser).Close
        - (io.ReadWriteCloser).Close
        - (*os.File).Close
        - (*github.com/gorilla/websocket.Conn).Close
        - (*github.com/mdlayher/vsock.Listener).Close
        - os.Remove
        - (*compress/gzip.Writer).Close
    revive:
      rules:
        - name: exported
          arguments:
            - checkPrivateReceivers
            - disableStutteringCheck
        - name: import-shadowing
        - name: unchecked-type-assertion
        - name: var-naming
          arguments:
            - []
            - []
            - - upperCaseConst: true
        - name: early-return
        - name: redundant-import-alias
        - name: redefines-builtin-id
        - name: struct-tag
        - name: receiver-naming
        - name: deep-exit
        - name: defer
        - name: bool-literal-in-expr
        - name: comment-spacings
        - name: use-any
        - name: bare-return
        - name: empty-block
        - name: range-val-address
        - name: range-val-in-closure
        - name: var-declaration
        - name: useless-break
        - name: error-naming
        - name: indent-error-flow
        - name: datarace
        - name: modifies-value-receiver
        - name: empty-lines
        - name: duplicated-imports
        - name: error-return
  exclusions:
    generated: lax
    rules:
      - linters:
          - revive
        source: '^//generate-database:mapper '
      - linters:
          - staticcheck
        text: "ST1005:"
    paths:
      - third_party$
      - builtin$
      - examples$
formatters:
  enable:
    - gci
    - gofumpt
    - goimports
  settings:
    gci:
      sections:
        - standard
        - default
        - prefix(github.com/lxc/incus)
    goimports:
      local-prefixes:
        - github.com/lxc/incus
  exclusions:
    generated: lax
    paths:
      - third_party$
      - builtin$
      - examples$
