Skip to content

Commit

Permalink
Refactoring: Use new range syntax introduced in Go 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
abicky committed Oct 28, 2024
1 parent b382a94 commit 7fe75f2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/capacity/capacity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func createInstance(az string) autoscalingtypes.Instance {
func createInstances(az string, size int) []autoscalingtypes.Instance {
azChar := az[len(az)-1:]
instances := make([]autoscalingtypes.Instance, size)
for i := 0; i < size; i++ {
for i := range size {
instances[i] = autoscalingtypes.Instance{
AvailabilityZone: aws.String(az),
InstanceId: aws.String(fmt.Sprintf("i-%s%08x%08d", azChar, rand.Int31(), i)),
Expand Down
2 changes: 1 addition & 1 deletion internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (s *Service) delete(ctx context.Context, cluster string, serviceName string

func retryOnServiceCreationTempErr(fn func() error, tries int) error {
var err error
for i := 0; i < tries; i++ {
for i := range tries {
if err = fn(); err == nil {
break
}
Expand Down
2 changes: 1 addition & 1 deletion internal/sliceutil/sliceutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestContains(t *testing.T) {
func TestChunkSlice(t *testing.T) {
n := 7
strs := make([]*string, n)
for i := 0; i < n; i++ {
for i := range n {
s := fmt.Sprint(i)
strs[i] = &s
}
Expand Down

0 comments on commit 7fe75f2

Please sign in to comment.