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

rustyeddy/fsutils: walk.go; 10 LoC

Open
#13,392 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [rustyeddy/fsutils](https://www.github.com/rustyeddy/fsutils) at [walk.go](https://github.com/rustyeddy/fsutils/blob/689b55b1721057772b451dd34c49bc3b602168d2/walk.go#L92-L101)

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 root used in defer or goroutine at line 95

[Click here to see the code in its original context.](https://github.com/rustyeddy/fsutils/blob/689b55b1721057772b451dd34c49bc3b602168d2/walk.go#L92-L101)

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

```go
for _, root := range w.Roots {
if w.UseDirChan {
go func() {
w.DirChan <- root
}()
} else {
w.Add(1)
go w.WalkDir(root)
}
}

```

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: 689b55b1721057772b451dd34c49bc3b602168d2

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with walk.go lines 92-101 and inspect how root is used by the two goroutine paths. Compare the analyzer finding with the repository's behavior, then leave the requested Bug, Mitigated, or Desirable Behavior reaction; completion is the classification reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.