Skip to content

Commit 7759f89

Browse files
author
Gustavo Bazan
authored
task: enable intrange check (#3838)
1 parent 5a4de09 commit 7759f89

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ linters:
2424
- govet
2525
- importas
2626
- ineffassign
27+
- intrange
2728
- makezero
2829
- misspell
2930
- mnd

internal/cli/streams/privatelink/list_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ import (
2828
)
2929

3030
func getPrivateLinkConnections() []atlasv2.StreamsPrivateLinkConnection {
31-
var connections []atlasv2.StreamsPrivateLinkConnection
31+
connections := make([]atlasv2.StreamsPrivateLinkConnection, 5)
3232

33-
for i := 0; i < 5; i++ {
33+
for i := range 5 {
3434
conn := atlasv2.NewStreamsPrivateLinkConnection()
3535
conn.SetId(fmt.Sprintf("testId%d", i))
3636
conn.SetProvider("Azure")
3737
conn.SetRegion("US_EAST_2")
3838
conn.SetServiceEndpointId("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace")
3939
conn.SetDnsDomain("test-namespace.servicebus.windows.net")
4040

41-
connections = append(connections, *conn)
41+
connections[i] = *conn
4242
}
4343

4444
return connections

internal/telemetry/read_answer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func listFields(target reflect.Value) []fieldValue {
3535
targetType := target.Type()
3636
numFields := targetType.NumField()
3737
ret := make([]fieldValue, numFields)
38-
for i := 0; i < numFields; i++ {
38+
for i := range numFields {
3939
ret[i] = fieldValue{
4040
field: targetType.Field(i),
4141
value: target.Field(i),

test/e2e/projectsettings/project_settings_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func TestProjectSettings(t *testing.T) {
6868
t.Run("Update", func(t *testing.T) {
6969
var settings atlasv2.GroupSettings
7070

71-
for i := 0; i < 10; i++ { // try again for 10 seconds
71+
for range 10 { // try again for 10 seconds
7272
cmd := exec.Command(cliPath,
7373
projectsEntity,
7474
settingsEntity,

test/internal/helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ func deleteAllPrivateEndpoints(t *testing.T, cliPath, projectID, provider string
734734
}
735735

736736
done := false
737-
for attempt := 0; attempt < 10; attempt++ {
737+
for range 10 {
738738
privateEndpoints = listPrivateEndpointsByProject(t, cliPath, projectID, provider)
739739
if len(privateEndpoints) == 0 {
740740
t.Logf("all %s private endpoints successfully deleted", provider)
@@ -760,7 +760,7 @@ func deleteAllStreams(t *testing.T, cliPath, projectID string) {
760760
}
761761

762762
done := false
763-
for attempt := 0; attempt < 10; attempt++ {
763+
for range 10 {
764764
streams = listStreamsByProject(t, cliPath, projectID)
765765
if streams.GetTotalCount() == 0 {
766766
t.Logf("all streams successfully deleted")

tools/cmd/templates-checker/templateparsing/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func getTemplateFields(namedTypeInfo *types.Named) (map[string]types.Type, error
176176
structStructure := make(map[string]types.Type)
177177

178178
// Add fields and embedded fields
179-
for i := 0; i < structInfo.NumFields(); i++ {
179+
for i := range structInfo.NumFields() {
180180
field := structInfo.Field(i)
181181
fieldName := field.Name()
182182
lowerCaseFieldName := strings.ToLower(fieldName)
@@ -204,7 +204,7 @@ func getTemplateFields(namedTypeInfo *types.Named) (map[string]types.Type, error
204204
}
205205

206206
// Add method names
207-
for i := 0; i < namedTypeInfo.NumMethods(); i++ {
207+
for i := range namedTypeInfo.NumMethods() {
208208
method := namedTypeInfo.Method(i)
209209

210210
// Only check public fields

0 commit comments

Comments
 (0)