`golangci-lint run`问题

huangapple go评论68阅读模式
英文:

`golangci-lint run` issue

问题

我在工作目录中创建了一个名为.golangci.yml的文件,其中包含比默认设置更多的linters,然后运行golangci-lint run -v命令,但发现linters仍然是默认值。有人遇到过相同的问题吗?我已经检查了.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
英文:

I create a .golangci.yml in working directory, which have more linters than default, and run golangci-lint run -v but found linters are still default value, anyone encountered same issue? I have checked .golangci.yml path is correct. below is our configure value:

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

答案1

得分: 0

这个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
英文:

This yaml file isn't indented properly. try:

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

huangapple
  • 本文由 发表于 2021年7月30日 19:19:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/68590095.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定