When it sees for _ = range x { ... }
, the simplifyrange
analyzer in gopls offers a suggested fix to remove the _ =
part. This is not legal in go1.23 if x is a func.
Comment From: findleyr
From dupes: - Don't forget gofmt -s - Don't forget the underlying spec proposal https://github.com/golang/go/issues/65236.
Comment From: gopherbot
Change https://go.dev/cl/588056 mentions this issue: gopls/internal/analysis/simplifyrange: suppress on range-over-func
Comment From: adonovan
Reopening since the proposal to make them optional again was accepted: - https://github.com/golang/go/issues/65236#issuecomment-2187122281
This change is expected to sneak into the go1.23 release candidate, so we can simply revert CL 588056 without worrying about whether the file has go1.23 of go1.24+ semantics.
Comment From: gopherbot
Change https://go.dev/cl/594555 mentions this issue: gopls/internal/analysis/simplifyrange: reenable on range-over-func
Comment From: gopherbot
Change https://go.dev/cl/596095 mentions this issue: gopls/internal/analysis/simplifyrange: reenable on range-over-func