Skip to content

gomnd regression in 1.35.2 #1653

@jkowalski

Description

@jkowalski

Thank you for creating the issue!

  • 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).

Please include the following information:

I'm trying to upgrade my project from 1.33 to 1.35 and getting weird random behavior of gomnd where magic constants are treated as not magic triggering nolint violation.

See the pull request to upgrade: kopia/kopia#786

It is failing GH checks: https://github.com/kopia/kopia/pull/786/checks?check_run_id=1715239415
Notice the linter passes on macOS, Windows and using provided GH Action but fails on Linux:

I can reproduce this with jkowalski/kopia@f0f8441:

$ GOOS=linux GOARCH=amd64 make lint
/Users/jarek/Projects/Kopia/tools/.tools/golangci-lint-1.35.2/golangci-lint --deadline 300s run 
repo/encryption/deprecated_ctr_encryptor.go:83:110: directive `//nolint:gomnd` is unused for linter gomnd (nolintlint)
	Register("AES-192-CTR", "DEPRECATED: AES-192 in CTR mode", true, newCTREncryptorFactory(24, aes.NewCipher)) //nolint:gomnd
	                                                                                                            ^
make: *** [lint] Error 1

$ GOOS=darwin GOARCH=amd64 make lint
/Users/jarek/Projects/Kopia/tools/.tools/golangci-lint-1.35.2/golangci-lint --deadline 300s run 

$ GOOS=windows GOARCH=amd64 make lint
/Users/jarek/Projects/Kopia/tools/.tools/golangci-lint-1.35.2/golangci-lint --deadline 300s run 

If you look at the history of this PR you'll find couple more spurious failures with gomnd that I have also fixed, such as kopia/kopia@1c56fb7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesRelates to an upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions