Re: [go-nuts] Go 1.22 code simplification

2024-01-16 Thread David Finkel
I don't know of anything that does those rewrites (and haven't looked), but it looks like gofmt -s could support it by extending this type-switch: https://cs.opensource.google/go/go/+/master:src/cmd/gofmt/simplify.go;l=16-103;drc=9b89c380208ea2e85985ee6bf2b1d684274dfa1d I like the idea of an autom

[go-nuts] Go 1.22 code simplification

2024-01-15 Thread Amnon
Go 1.22 contains some cool features which will allow us to write simpler code. Would it be possible for gofmt -s to help us do transformations which clean up old code such as for i := 0; i < n; i++ -> for i := range n removing x := x assignments inside range loops or updating code to use the