github-vet / github-vet/rangeloop-pointer-findings
Vlad104/TP_GO_HW2: signer.go; 17 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Vlad104/TP_GO_HW2](https://www.github.com/Vlad104/TP_GO_HW2) at [signer.go](https://github.com/Vlad104/TP_GO_HW2/blob/b7977993fbfe1877ce1254287ac783aff7917727/signer.go#L66-L82)
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 chanData used in defer or goroutine at line 69
[Click here to see the code in its original context.](https://github.com/Vlad104/TP_GO_HW2/blob/b7977993fbfe1877ce1254287ac783aff7917727/signer.go#L66-L82)
Click here to show the 17 line(s) of Go which triggered the analyzer.
```go
for chanData := range in {
go func() {
defer wg.Done()
data := fmt.Sprint(chanData)
hashes := make([]string, th)
wg.Add(1)
localWg := &sync.WaitGroup{}
for i := 0; i < th; i++ {
localWg.Add(1)
thData := strconv.Itoa(i) + data
go crc32HashCalc(localWg, thData, &hashes[i])
}
localWg.Wait()
out <- strings.Join(hashes, "")
}()
}
```
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: b7977993fbfe1877ce1254287ac783aff7917727
Contributor guide
No contributing guide indexed for this repository
Research direction
Open signer.go at lines 66-82 in commit b7977993fbfe1877ce1254287ac783aff7917727 and inspect how chanData is used inside the goroutine. Compare the analyzer message with the surrounding code to decide whether this is a bug, mitigated finding, or desirable behavior. Finish by leaving the corresponding reaction on the issue.
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
- Clearly specified
- Newbie friendliness
- 45/100