Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gomnd: Versions 1.58.0+ break backward compatibility and do not work with older configs #4767

Closed
5 tasks done
tony2001 opened this issue May 28, 2024 · 6 comments · Fixed by #4768
Closed
5 tasks done
Labels
bug Something isn't working

Comments

@tony2001
Copy link

tony2001 commented May 28, 2024

Welcome

Description of the problem

Version 1.58.0 has broken BC because gomnd linter was renamed to mnd:

WARN [runner] Can't run linter goanalysis_metalinter: failed to pre-run gomnd: failed to configure analyzers: settings key "mnd" must be valid analyzer name, valid analyzers: [gomnd] 
ERRO Running error: can't run linter goanalysis_metalinter
failed to pre-run gomnd: failed to configure analyzers: settings key "mnd" must be valid analyzer name, valid analyzers: [gomnd] 

Version of golangci-lint

golangci-lint has version 1.58.0 built with go1.22.2 from 28b3813 on 2024-05-03T18:05:38Z

Configuration

linters-settings:
  gomnd:
    settings:
      mnd:
        checks: arguments

linters:
  disable-all: true
  enable:
    - gomnd
~             

Go environment

$ go version
go version go1.22.3 linux/amd64

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v

INFO [config_reader] Used config file .golangci.yml 
WARN [config_reader] The configuration option `linters.gomnd.settings` is deprecated. Please use the options `linters.gomnd.checks`,`linters.gomnd.ignored-numbers`,`linters.gomnd.ignored-files`,`linters.gomnd.ignored-functions`. 
WARN The linter 'gomnd' is deprecated (since v1.58.0) due to: The linter has been renamed. Replaced by mnd. 
INFO [lintersdb] Active 1 linters: [gomnd]        
INFO [loader] Go packages loading at mode 7 (compiled_files|name|files) took 133.190421ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 5.855611ms 
WARN [runner] Can't run linter goanalysis_metalinter: failed to pre-run gomnd: failed to configure analyzers: settings key "mnd" must be valid analyzer name, valid analyzers: [gomnd] 
INFO [runner] processing took 3.135µs with stages: max_same_issues: 971ns, skip_dirs: 308ns, identifier_marker: 229ns, cgo: 228ns, filename_unadjuster: 172ns, source_code: 148ns, skip_files: 147ns, invalid_issue: 140ns, path_prettifier: 139ns, exclude: 129ns, max_from_linter: 63ns, nolint: 53ns, fixer: 48ns, path_shortener: 46ns, autogenerated_exclude: 46ns, sort_results: 45ns, diff: 41ns, exclude-rules: 37ns, severity-rules: 37ns, path_prefixer: 36ns, max_per_file_from_linter: 36ns, uniq_by_line: 36ns 
INFO [runner] linters took 53.921µs with stages: goanalysis_metalinter: 23.213µs 
ERRO Running error: can't run linter goanalysis_metalinter
failed to pre-run gomnd: failed to configure analyzers: settings key "mnd" must be valid analyzer name, valid analyzers: [gomnd] 
INFO Memory: 3 samples, avg is 27.5MB, max is 30.3MB 
INFO Execution took 141.860442ms 

A minimal reproducible example or link to a public repository

// no actual code is required

Validation

  • Yes, I've included all information above (version, config, etc.).
@tony2001 tony2001 added the bug Something isn't working label May 28, 2024
Copy link

boring-cyborg bot commented May 28, 2024

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez changed the title Versions 1.58.0+ break backward compatibility and do not work with older configs gomnd: Versions 1.58.0+ break backward compatibility and do not work with older configs May 28, 2024
@tony2001
Copy link
Author

Just to clarify, this is what I get with v1.57.0 (golangci-lint has version 1.57.0 built with go1.22.1 from ddc703d on 2024-03-19T23:16:39Z) and the config above:

 $ golangci-lint run ./...
$ 

No warnings.

And this is what I get with v1.58.0 (golangci-lint has version 1.58.0 built with go1.22.2 from 28b3813 on 2024-05-03T18:05:38Z)

$ golangci-lint run ./...
WARN [config_reader] The configuration option `linters.gomnd.settings` is deprecated. Please use the options `linters.gomnd.checks`,`linters.gomnd.ignored-numbers`,`linters.gomnd.ignored-files`,`linters.gomnd.ignored-functions`. 
WARN The linter 'gomnd' is deprecated (since v1.58.0) due to: The linter has been renamed. Replaced by mnd. 
WARN [runner] Can't run linter goanalysis_metalinter: failed to pre-run gomnd: failed to configure analyzers: settings key "mnd" must be valid analyzer name, valid analyzers: [gomnd] 
ERRO Running error: can't run linter goanalysis_metalinter
failed to pre-run gomnd: failed to configure analyzers: settings key "mnd" must be valid analyzer name, valid analyzers: [gomnd]

@ldez
Copy link
Member

ldez commented May 28, 2024

Hello,

By default, golangci-lint doesn't provide backward compatibility with linter configuration because we cannot control the linter configuration.
We try to ensure compatibility but it's not always possible.

The section settings inside the gomnd configuration has already been deprecated since 2022.

I will see if we can fix that.

@tony2001
Copy link
Author

The section settings inside the gomnd configuration has already been deprecated since 2022.

Doesn't that mean the should have been some warnings?

@ldez
Copy link
Member

ldez commented May 28, 2024

The missing warnings have been added in v1.57.2

#4568

@ldez
Copy link
Member

ldez commented May 28, 2024

I find a fix: #4768

But following our linter deprecation cycle, I want to inform you that gomnd should be removed from your configuration and replaced by mnd.

https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants