Skip to content

WARN The linter 'gomnd' is deprecated (since v1.58.0) due to: The linter has been renamed. Replaced by mnd. #4741

@ldemailly

Description

@ldemailly

Welcome

Description of the problem

Without any mention of gonmd in my config file I get

WARN The linter 'gomnd' is deprecated (since v1.58.0) due to: The linter has been renamed. Replaced by mnd. 
grep gomnd .golangci.yml  # empty

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.58.2 built with go1.22.3 from 8c4cfb61 on 2024-05-19T18:08:33Z

Configuration

# Config for golangci-lint - shared across fortio org projects (included by gochecks workflow step)

# output configuration options

# all available settings of specific linters
linters-settings:
  dupl:
    # tokens count to trigger issue, 150 by default
    threshold: 100
  exhaustive:
    # indicates that switch statements are to be considered exhaustive if a
    # 'default' case is present, even if all enum members aren't listed in the
    # switch
    default-signifies-exhaustive: false
  funlen:
    lines: 140
    statements: 70
  gocognit:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 42
  nestif:
    # minimal complexity of if statements to report, 5 by default
    min-complexity: 4
  gocyclo:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 30
  godot:
    # check all top-level comments, not only declarations
    check-all: false
  govet:
    # report about shadowed variables
    shadow: true
    # settings per analyzer
    settings:
      printf: # analyzer name, run `go tool vet help` to see all analyzers
        funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
          - (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
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Printf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).FErrf
    enable-all: true
    disable-all: false
  lll:
    # max line length, lines longer will be reported. Default is 120.
    # '\t' is counted as 1 character by default, and can be changed with the tab-width option
    line-length: 132
    # tab width in spaces. Default to 1.
    tab-width: 1
  misspell:
    # Correct spellings using locale preferences for US or UK.
    # Default is to use a neutral variety of English.
    # Setting locale to US will correct the British spelling of 'colour' to 'color'.
    locale: US
    ignore-words:
      - fortio
  nakedret:
    # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
    max-func-lines: 30
  nolintlint:
    require-specific: true
  whitespace:
    multi-if: false   # Enforces newlines (or comments) after every multi-line if statement
    multi-func: false # Enforces newlines (or comments) after every multi-line function signature
  gofumpt:
    # Choose whether or not to use the extra rules that are disabled
    # by default
    extra-rules: false


linters:
  disable:
    # bad ones:
    - musttag
    # Deprecated ones:
    - scopelint
    - golint
    - interfacer
    - maligned
    - varcheck
    - structcheck
    - nosnakecase
    - deadcode
    # Weird/bad ones:
    - wsl
    - nlreturn
    - gochecknoinits
    - gochecknoglobals
    - mnd
    - testpackage
    - wrapcheck
    - exhaustivestruct
    - tagliatelle
    - nonamedreturns
    - varnamelen
    - exhaustruct # seems like a good idea at first but actually a pain and go does have zero values for a reason.
# TODO consider putting these back, when they stop being bugged (ifshort, wastedassign,...)
    - paralleltest
    - thelper
    - forbidigo
    - ifshort
    - wastedassign
    - cyclop
    - forcetypeassert
    - ireturn
    - depguard
  enable-all: true
  disable-all: false
  # Must not use fast: true in newer golangci-lint or it'll just skip a bunch of linter instead of doing caching like before (!)
  fast: false


issues:
  # Excluding configuration per-path, per-linter, per-text and per-source
  exclude-rules:
    # Exclude some linters from running on tests files.
    - path: _test\.go
      linters:
        - gocyclo
        - errcheck
        - dupl
        - gosec
        - gochecknoinits
        - gochecknoglobals
        - forcetypeassert
        - nosnakecase
        - noctx
        - goconst

    # Exclude lll issues for long lines with go:generate
    - linters:
        - lll
      source: "^//go:generate "
    - linters:
        - goerr113
      text: "do not define dynamic errors"
    - linters:
        - govet
      text: "fieldalignment:"
    - linters:
        - godox
      text: "TODO"
    - linters:
        - nosnakecase
      text: "grpc_|_SERVING|O_"

  # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  max-issues-per-linter: 0

  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  max-same-issues: 0

severity:
  # Default value is empty string.
  # Set the default severity for issues. If severity rules are defined and the issues
  # do not match or no severity is provided to the rule this will be the default
  # severity applied. Severities should match the supported severity names of the
  # selected out format.
  # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
  # -   Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
  # -       Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
  default-severity: error

  # The default value is false.
  # If set to true severity-rules regular expressions become case sensitive.
  case-sensitive: false

Go environment

$ go version && go env
go version go1.22.3 darwin/arm64
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/dl/Library/Caches/go-build'
GOENV='/Users/dl/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/dl/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/dl/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/dl/dev/fortio.org/fortio/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/fq/gng4z4915mb73r9js_422h4c0000gn/T/go-build2519150692=/tmp/go-build -gno-record-gcc-switches -fno-common'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/dl/dev/fortio.org/fortio /Users/dl/dev/fortio.org /Users/dl/dev /Users/dl /Users /] 
INFO [config_reader] Used config file .golangci.yml 
WARN [config_reader] The configuration option `linters.errcheck.ignore` is deprecated, please use `linters.errcheck.exclude-functions`. 
WARN The linter 'execinquery' is deprecated (since v1.58.0) due to: The repository of the linter has been archived by the owner.  
WARN The linter 'gomnd' is deprecated (since v1.58.0) due to: The linter has been renamed. Replaced by mnd. 
INFO [lintersdb] Active 88 linters: [asasalint asciicheck bidichk bodyclose canonicalheader containedctx contextcheck copyloopvar decorder dogsled dupl dupword durationcheck err113 errcheck errchkjson errname errorlint execinquery exhaustive exportloopref fatcontext funlen gci ginkgolinter gocheckcompilerdirectives gochecksumtype gocognit goconst gocritic gocyclo godot godox gofmt gofumpt goheader goimports gomnd gomoddirectives gomodguard goprintffuncname gosec gosimple gosmopolitan govet grouper importas inamedparam ineffassign interfacebloat intrange lll loggercheck maintidx makezero mirror misspell nakedret nestif nilerr nilnil noctx nolintlint nosprintfhostport perfsprint prealloc predeclared promlinter protogetter reassign revive rowserrcheck sloglint spancheck sqlclosecheck staticcheck stylecheck tagalign tenv testableexamples testifylint tparallel unconvert unparam unused usestdlibvars whitespace zerologlint] 
[...]

A minimal reproducible example or link to a public repository

file doesn't matter as the warning is before running

Validation

  • Yes, I've included all information above (version, config, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions