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

igungor/putiofs: fs.go; 16 LoC

Open
#14,881 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 [igungor/putiofs](https://www.github.com/igungor/putiofs) at [fs.go](https://github.com/igungor/putiofs/blob/35edd20f4334de04c72d71da571057e07e2b5b76/fs.go#L266-L281)

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.

> reference to file was used in a composite literal at line 274

[Click here to see the code in its original context.](https://github.com/igungor/putiofs/blob/35edd20f4334de04c72d71da571057e07e2b5b76/fs.go#L266-L281)

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

```go
for _, file := range files {
if file.Name != filename {
continue
}

if file.IsDir() {
return &Dir{
fs: d.fs,
File: &file,
}, nil
}
return &File{
fs: d.fs,
File: &file,
}, nil
}

```

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: 35edd20f4334de04c72d71da571057e07e2b5b76

Contributor guide

No contributing guide indexed for this repository

Research direction

Read fs.go lines 266-281 and review the linked analyzer guidance for range-loop pointer findings. Decide whether this instance is a Bug, Mitigated, or Desirable Behavior, then mark the issue with the corresponding reaction; completion is the classification reaction being recorded.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.