Open tkw1536 opened 4 months ago
At the moment this is out of scope for staticcheck
. We don't want to start flagging over a decade of existing, valid code. We could implement it as a quickfix for gopls, if they don't already have such a check.
If your are interested, there is this linter
https://github.com/ckaznocha/intrange
Available in golangci-lint since 1.57.0
With the release of go1.22, range over integers is now in the language. Code such as:
can be replaced with the more idiomatic:
It would be great if
staticcheck
could add a check to suggest such changes automatically.