Repository navigation
chore: quick cleanup #2239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: quick cleanup #2239
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -99,10 +99,10 @@ func TestCacheConcurrency(t *testing.T) { | |||||||||||||||||||||||
| var wg sync.WaitGroup | ||||||||||||||||||||||||
| wg.Add(goroutines) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for i := 0; i < goroutines; i++ { | ||||||||||||||||||||||||
| for i := range goroutines { | ||||||||||||||||||||||||
| go func(id int) { | ||||||||||||||||||||||||
| defer wg.Done() | ||||||||||||||||||||||||
| for j := 0; j < operations; j++ { | ||||||||||||||||||||||||
| for j := range operations { | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| // Test concurrent item operations | ||||||||||||||||||||||||
|
Comment on lines
+102
to
106
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Range-over-integer causes compilation failure
- for i := range goroutines {
+ for i := 0; i < goroutines; i++ {
…
- for j := range operations {
+ for j := 0; j < operations; j++ {📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||
| value := fmt.Sprintf("value-%d-%d", id, j) | ||||||||||||||||||||||||
| cache.SetItem(uint64(j), &value) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -57,7 +57,8 @@ func getAddr(sk crypto.PrivKey) (multiaddr.Multiaddr, error) { | |||||
| if len(id) > 8 { | ||||||
| suffix = id[len(id)-8:] | ||||||
| } | ||||||
| ip := append(net.IP{}, unicastAddr...) | ||||||
| ip := make(net.IP, len(unicastAddr)) | ||||||
| copy(ip, unicastAddr) | ||||||
| copy(ip[net.IPv6len-len(suffix):], suffix) | ||||||
| a, err := multiaddr.NewMultiaddr(fmt.Sprintf("/ip6/%s/tcp/4242", ip)) | ||||||
| if err != nil { | ||||||
|
|
@@ -71,7 +72,7 @@ func startTestNetwork(ctx context.Context, t *testing.T, n int, conf map[int]hos | |||||
| require := require.New(t) | ||||||
|
|
||||||
| mnet := mocknet.New() | ||||||
| for i := 0; i < n; i++ { | ||||||
| for i := range n { | ||||||
|
||||||
| for i := range n { | |
| for i := 0; i < n; i++ { |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -391,9 +391,9 @@ func TestConcurrentAccess(t *testing.T) { | |
| errChan := make(chan error, numGoRoutines*messageCount) | ||
| doneChan := make(chan struct{}) | ||
|
|
||
| for i := 0; i < numGoRoutines; i++ { | ||
| for i := range numGoRoutines { | ||
| go func(routineNum int) { | ||
| for j := 0; j < messageCount; j++ { | ||
| for j := range messageCount { | ||
|
||
| // Create a unique message per goroutine and iteration | ||
| message := fmt.Appendf(nil, "Message %d-%d", routineNum, j) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'for range' on 'dAFetcherRetries' (an integer) is not valid. Consider using 'for r := 0; r < dAFetcherRetries; r++' instead.