Skip to content

modernize and revive linters reports #6232

@alex-aizman

Description

@alex-aizman

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

I don't know

Description of the problem

it is a minor problem that boils down to false positives and wrong recommendations

reproducible if you just

git clone https://github.com/NVIDIA/aistore
make lint

The result:

$ golangci-lint version
golangci-lint has version 2.7.0 built with go1.25.4 from e6ebea01 on 2025-12-03T19:50:52Z
$ 
$ make lint
Running lint...
ais/backend/azure.go:194:11: stringscut: strings.Index can be simplified using strings.Cut (modernize)
                if i := strings.Index(line, azErrCode); i > 0 {
                        ^
ais/dpq.go:244:10: stringscut: strings.IndexByte can be simplified using strings.Cut (modernize)
        if i := strings.IndexByte(s, '='); i > 0 {
                ^
cmn/bck.go:120:9: stringscut: strings.IndexByte can be simplified using strings.Cut (modernize)
        idx := strings.IndexByte(s, apc.NsNamePrefix)
               ^
cmn/certloader/certloader.go:314:7: stringscut: strings.Index can be simplified using strings.Cut (modernize)
        i := strings.Index(s, " +")
             ^
cmn/cos/template.go:405:12: stringscut: strings.IndexByte can be simplified using strings.Cut (modernize)
                right := strings.IndexByte(template, '@')
                         ^
cmn/k8s/k8s.go:113:9: stringscut: strings.IndexByte can be simplified using strings.Cut (modernize)
        idx := strings.IndexByte(msg, ',')
               ^
fs/fqn.go:57:7: stringscut: strings.IndexByte can be simplified using strings.Cut (modernize)
        j := strings.IndexByte(ct, filepath.Separator)
             ^
api/multiobj.go:5:9: var-naming: avoid meaningless package names (revive)
package api
        ^
8 issues:
* modernize: 7
* revive: 1
make: *** [Makefile:291: lint] Error 1

Problems:

  1. IndexByte() does not apply
  2. Index() should not be recommended when we are specifically looking for i > 0
  3. revive error makes no sense

Version of golangci-lint

$ golangci-lint --version
# Paste output here

Configuration

# paste configuration file or CLI flags here

Go environment

$ go version && go env
# paste output here

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

A minimal reproducible example or link to a public repository

// add your code here

Validation

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

Supporter

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