github-vet / github-vet/rangeloop-pointer-findings

dasJ/versioncheck: notificator/notificator.go; 26 LoC

Open
#15,663 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [dasJ/versioncheck](https://www.github.com/dasJ/versioncheck) at [notificator/notificator.go](https://github.com/dasJ/versioncheck/blob/39755de36fd2804ff7648656ba1fb708461499c0/notificator/notificator.go#L16-L41)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

> range-loop variable item used in defer or goroutine at line 20

[Click here to see the code in its original context.](https://github.com/dasJ/versioncheck/blob/39755de36fd2804ff7648656ba1fb708461499c0/notificator/notificator.go#L16-L41)

Click here to show the 26 line(s) of Go which triggered the analyzer.

```go
for _, item := range res.Changed {
wait.Add(1)
go func() {
args := []string{
item.Name,
item.Module,
item.OldVersion,
item.NewVersion,
}
args = append(args, item.Tags...)
cmd := exec.Command(cfg.Notificator, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Start()
if err != nil {
fmt.Printf("%s\n", err)
wait.Done()
return
}
err = cmd.Wait()
if err != nil {
fmt.Printf("%s\n", err)
}
wait.Done()
}()
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 39755de36fd2804ff7648656ba1fb708461499c0

Contributor guide

No contributing guide indexed for this repository

Research direction

Open notificator/notificator.go at lines 16-41 and read the goroutine launched inside the range over res.Changed. Compare the analyzer report with the project's classification guidance, then leave the requested reaction for Bug, Mitigated, or Desirable Behavior; completion is the selected classification.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.