github-vet / github-vet/rangeloop-pointer-findings
jeffotoni/goexample: govet/example4.go; 5 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jeffotoni/goexample](https://www.github.com/jeffotoni/goexample) at [govet/example4.go](https://github.com/jeffotoni/goexample/blob/8dfa98108d58380014b1948ebde67de69f1a8d38/govet/example4.go#L17-L21)
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 word used in defer or goroutine at line 19
[Click here to see the code in its original context.](https://github.com/jeffotoni/goexample/blob/8dfa98108d58380014b1948ebde67de69f1a8d38/govet/example4.go#L17-L21)
Click here to show the 5 line(s) of Go which triggered the analyzer.
```go
for _, word := range lang {
go func() {
fmt.Println(word)
}()
}
```
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: 8dfa98108d58380014b1948ebde67de69f1a8d38
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect govet/example4.go at lines 17-21 in the linked commit, then review how the goroutine uses the range-loop variable word. Decide whether the analyzer finding is a bug, mitigated, or desirable behavior, and leave the corresponding reaction on the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100