Skip to content

v1.48: nolint default config conlicts with go fmt  #3098

Closed
@amass01

Description

@amass01

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

Latest (v1.48) nolintlint default config has a conflict with 1.19 gofmt.
After #3002 nolintlint complains about leading spaces in //nolint comments
by default and the gofmt command re-adds the leading space.

Version of golangci-lint

$ golangci-lint --version
v1.48

Configuration file

$ cat .golangci.yml
linters:
  enable:
    - bodyclose
    - deadcode
    - depguard
    - dogsled
    - dupl
    - errcheck
    - exhaustive
    - exportloopref
    - funlen
    - gochecknoinits
    - goconst
    - gocritic
    - gocyclo
    - gofmt
    - goimports
    - gomnd
    - goprintffuncname
    - gosec
    - gosimple
    - govet
    - ineffassign
    - misspell
    - nakedret
    - noctx
    - nolintlint
    - revive
    - rowserrcheck
    - staticcheck
    - structcheck
    - stylecheck
    - typecheck
    - unconvert
    - unparam
    - unused
    - varcheck
    - whitespace

Go environment

$ go version && go env
1.19

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
Error: directive `// nolint` should be written without leading space as `//nolint` (nolintlint)

Code example or link to a public repository

// nolint 

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions