Skip to content

refactor: use integer ranges for counted loops#348

Open
tenthirtyam wants to merge 1 commit into
hashicorp:mainfrom
tenthirtyam:refactor/simplify-counted-loops
Open

refactor: use integer ranges for counted loops#348
tenthirtyam wants to merge 1 commit into
hashicorp:mainfrom
tenthirtyam:refactor/simplify-counted-loops

Conversation

@tenthirtyam

Copy link
Copy Markdown

Description

Adopt Go 1.22+ integer range syntax to make loop intent clearer and eliminate manual initialization, conditions, and increments.

Resolved Issues

In Go 1.22+, three-clause for loops of the form for i := 0; i < n; I++ that can be replaced with for i := range n (). Using range over an integer keeps the intent clear and removes boilerplate loop control code.

Rollback Plan

Revert commit.

Changes to Security Controls

None.

Adopt Go 1.22+ integer range syntax to make loop intent clearer and eliminate manual initialization, conditions, and increments.

Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
@tenthirtyam
tenthirtyam requested a review from a team as a code owner July 24, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant