Skip to content

Conversation

@andig
Copy link
Member

@andig andig commented Aug 11, 2025

naltatis and others added 30 commits August 11, 2025 11:13
Co-authored-by: Michael Geers <michael@geers.tv>
Co-authored-by: interstart <toth.zoltan@hotmail.hu>
Co-authored-by: Qian Qin <mail@qianqin.de>
Co-authored-by: Ante Karamatic <ante@karamatic.hr>
Co-authored-by: Žiga Deisinger <ziga@deisinger.si>
Co-authored-by: Nick Galfas <nick@galfas.gr>
Co-authored-by: 19atlas <o.ustuncelik@gmail.com>
Co-authored-by: Michael Geers <michael@geers.tv>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Michael Geers <michael@geers.tv>
Co-authored-by: Michael Geers <michael@geers.tv>
@andig andig added the infrastructure Basic functionality label Aug 11, 2025
@andig andig marked this pull request as draft August 11, 2025 09:50
@andig andig marked this pull request as ready for review August 14, 2025 12:30
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The for range num loops (where num is an int) won’t compile—replace with a classic for i := 0; i < num; i++ or range over a slice.
  • When calling wg.Go inside loops, make sure to capture loop variables (e.g. i, lp) in the closure or pass them as parameters so each goroutine sees the correct value.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `for range num` loops (where num is an int) won’t compile—replace with a classic `for i := 0; i < num; i++` or range over a slice.
- When calling `wg.Go` inside loops, make sure to capture loop variables (e.g. `i`, `lp`) in the closure or pass them as parameters so each goroutine sees the correct value.

## Individual Comments

### Comment 1
<location> `cmd/detect/work.go:17` </location>
<code_context>
+func workers(log *util.Logger, num int, ips <-chan string, hits chan<- []tasks.Result) *sync.WaitGroup {
 	var wg sync.WaitGroup
+
 	for range num {
-		wg.Add(1)
-		go func() {
</code_context>

<issue_to_address>
Using 'for range num' is incorrect for iterating an integer count.

Replace 'for range num' with 'for i := 0; i < num; i++ {' to ensure the loop runs 'num' times and spawns the intended number of workers.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@andig andig enabled auto-merge (squash) August 14, 2025 14:19
@andig andig merged commit 6f03177 into master Aug 14, 2025
6 checks passed
@andig andig deleted the chore/go-125 branch August 14, 2025 14:21
thecem pushed a commit to thecem/evcc that referenced this pull request Sep 11, 2025
StarF666 pushed a commit to StarF666/evcc that referenced this pull request Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Basic functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.