首页 > 解决方案 > `golangci-lint 运行`问题

问题描述

.golangci.yml我在工作目录中创建了一个linters超过默认值的目录,然后运行golangci-lint run -v但发现 linter 仍然是默认值,有人遇到过同样的问题吗?我检查了.golangci.yml路径是否正确。下面是我们的配置值:

linters:
disable-all: true
enable:
  - bodyclose
  - deadcode
  - depguard
  - dogsled
  - dupl
  - errcheck
  - exhaustive
  - gochecknoinits
  - goconst
  - gocritic
  - gofmt
  - gomnd
  - goprintffuncname
  - gosec
  - gosimple
  - govet
  - ineffassign
  - interfacer
  - lll
  - misspell
  - nakedret
  - noctx

标签: golint

解决方案


此 yaml 文件未正确缩进。尝试:

linters:
  enable:
    - bodyclose
    - deadcode
    - depguard
    - dogsled
    - dupl
    - errcheck
    - exhaustive
    - gochecknoinits
    - goconst
    - gocritic
    - gofmt
    - gomnd
    - goprintffuncname
    - gosec
    - gosimple
    - govet
    - ineffassign
    - interfacer
    - lll
    - misspell
    - nakedret
    - noctx

推荐阅读