英文:
`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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论