github-vet / github-vet/rangeloop-pointer-findings
homeport/havener: pkg/havener/logs.go; 37 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [homeport/havener](https://www.github.com/homeport/havener) at [pkg/havener/logs.go](https://github.com/homeport/havener/blob/1ef361e4db7526e981c7f56cb78a49d031fe3e13/pkg/havener/logs.go#L239-L275)
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 container used in defer or goroutine at line 255
[Click here to see the code in its original context.](https://github.com/homeport/havener/blob/1ef361e4db7526e981c7f56cb78a49d031fe3e13/pkg/havener/logs.go#L239-L275)
Click here to show the 37 line(s) of Go which triggered the analyzer.
```go
for _, container := range pod.Spec.Containers {
// Ignore all container that have no shell available
if err := h.PodExec(pod, container.Name, []string{"/bin/sh", "-c", "true"}, nil, ioutil.Discard, nil, false); err != nil {
continue
}
if err := createDirectory(baseDir); err != nil {
errors = append(errors, err)
continue
}
read, write := io.Pipe()
go func() {
defer write.Close()
err := h.PodExec(
pod,
container.Name,
[]string{"/bin/sh", "-c",
fmt.Sprintf(
retrieveScript,
strings.Join(findCommands, "; "),
)},
nil,
write,
nil,
false,
)
if err != nil {
errors = append(errors, err)
}
}()
if err := untar(read, filepath.Join(baseDir, container.Name)); err != nil {
errors = append(errors, err)
}
}
```
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: 1ef361e4db7526e981c7f56cb78a49d031fe3e13
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.