-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Open
Labels
Description
Terraform Version
The main branchUse Cases
Just improving the speed of Terraform, updating it with new GoLang features that are faster and more semantic-sugar-like.
Attempted Solutions
I'd open a PR to update the cases of the rangeint matches from modernize I found, but I don't want to spend time on it if it won't receive attention by the maintainers.
Proposal
https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize has a list of suggestions to update to use features in newer GoLang versions. Based on a quick search, the rangeint replacement suggestion seems to be slightly faster, and in any case, it looks more GoLang-ish.
rangeint: replace a 3-clause "for i := 0; i < n; i++" loop by "for i := range n", added in go1.22.
There are also cases of this in the code base.
stringsseq: replace Split in "for range strings.Split(...)" by go1.24's more efficient SplitSeq, or Fields with FieldSeq.
References
No response