Skip to content

Commit

Permalink
chore: add support for intrange (scaleway#2710)
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone authored Aug 20, 2024
1 parent e16f542 commit d07d621
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ linters:
- grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
- importas # Enforces consistent import aliases [fast: false, auto-fix: false]
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
- intrange # intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false]
- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
- loggercheck # (logrlint): Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]
- makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
Expand Down
2 changes: 1 addition & 1 deletion internal/cdf/locality.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func expandListKeys(key string, diff *schema.ResourceDiff) []string {

keys := make([]string, 0, listLength)

for i := 0; i < listLength; i++ {
for i := range listLength {
addr[index] = strconv.FormatInt(int64(i), 10)
keys = append(keys, strings.Join(addr, "."))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/types/string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestStringHashcode_positiveIndex(t *testing.T) {
func TestStringHashcode(t *testing.T) {
v := "hello, world"
expected := types.StringHashcode(v)
for i := 0; i < 100; i++ {
for range 100 {
actual := types.StringHashcode(v)
if actual != expected {
t.Fatalf("bad: %#v\n\t%#v", actual, expected)
Expand Down
2 changes: 1 addition & 1 deletion internal/workerpool/workerpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewWorkerPool(size int) *WorkerPool {
tasksToRun: make(chan Task, size),
}

for i := 0; i < size; i++ {
for range size {
go p.worker()
}

Expand Down
4 changes: 2 additions & 2 deletions internal/workerpool/workerpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestWorkerPoolWaitTimeMultiple(t *testing.T) {
pool := workerpool.NewWorkerPool(5)
iterations := 20

for i := 0; i < iterations; i++ {
for i := range iterations {
copyOfI := i

pool.AddTask(func() error {
Expand All @@ -77,7 +77,7 @@ func TestWorkerPoolWaitTimeMultiple(t *testing.T) {

assert.Len(t, errs, iterations/2)

for i := 0; i < iterations; i++ {
for i := range iterations {
if i%2 == 0 {
found := false
for _, err := range errs {
Expand Down

0 comments on commit d07d621

Please sign in to comment.