Sign inSign up

nanxi/golangci-lint

By nanxi

Updated over 5 years ago

Image
0

156

nanxi/golangci-lint repository overview

Usage

 docker run --rm -v $(pwd):/app -w /app nanxi/golangci-lint:v1.35-alpine golangci-lint run -v

Build

Dockerfile

FROM  golangci/golangci-lint:v1.35-alpine
ADD .golangci.yml /root/
CMD ["golangci-lint"]

.golangci.yml

linters-settings:
  depguard:
    list-type: blacklist
    packages:
      # logging is allowed only by logutils.Log, logrus
      # is allowed to use only in logutils package
      - github.com/sirupsen/logrus
    packages-with-error-message:
      - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
  dupl:
    threshold: 100
  funlen:
    lines: 100
    statements: 50
  gci:
    local-prefixes: github.com/golangci/golangci-lint
  goconst:
    min-len: 2
    min-occurrences: 2
  gocritic:
    disabled-checks:
      - ifElseChain
      - wrapperFunc
  gocyclo:
    min-complexity: 15
  goimports:
    local-prefixes: github.com/golangci/golangci-lint
  golint:
    min-confidence: 0
  gomnd:
    settings:
      mnd:
        # don't include the "operation" and "assign"
        checks: argument,case,condition,return
  govet:
    check-shadowing: false
    settings:
      printf:
        funcs:
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
  lll:
    line-length: 140
  maligned:
    suggest-new: true
  misspell:
    locale: US
  nolintlint:
    allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
    allow-unused: false # report any unused nolint directives
    require-explanation: false # don't require an explanation for nolint directives
    require-specific: false # don't require nolint directives to be specific about which linter is being skipped

linters:
  # please, do not use `enable-all`: it's deprecated and will be removed soon.
  # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
  disable-all: true
  enable:
    - deadcode
    - errcheck
    - gosimple
    - govet
    - ineffassign
    - staticcheck
    - structcheck
    - typecheck
    - varcheck
    - bodyclose
    - dupl
    - errorlint
    - exportloopref
    - funlen
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - gofmt
    - golint
    - goprintffuncname
    - gosec
    - interfacer
    - maligned
    - prealloc
    - stylecheck
    - unconvert
    - whitespace

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

issues:
  # Excluding configuration per-path, per-linter, per-text and per-source
  exclude-rules:
    - path: _test\.go
      linters:
        - gomnd

    # https://github.com/go-critic/go-critic/issues/926
    - linters:
        - gocritic
      text: "unnecessaryDefer:"

    # TODO temporary rule, must be removed
    # seems related to v0.34.1, but I was not able to reproduce locally,
    # I was also not able to reproduce in the CI of a fork,
    # only the golangci-lint CI seems to be affected by this invalid analysis.
    - path: pkg/golinters/scopelint.go
      text: 'directive `//nolint:interfacer` is unused for linter interfacer'

run:
  skip-dirs:
    - test/testdata_etc
    - internal/cache
    - internal/renameio
    - internal/robustio

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
  golangci-lint-version: 1.23.x # use the fixed version to not introduce new linters unexpectedly
  prepare:
    - echo "here I can run custom commands, but no preparation needed for this repo"

Tag summary

Content type

Image

Digest

Size

187.9 MB

Last updated

over 5 years ago

docker pull nanxi/golangci-lint:v1.35-alpine