github-vet / github-vet/rangeloop-pointer-findings
clearcontainers/tests: cmd/localCI/repo.go; 53 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [clearcontainers/tests](https://www.github.com/clearcontainers/tests) at [cmd/localCI/repo.go](https://github.com/clearcontainers/tests/blob/21e54715679c48a0ac2c695f81d7d63a5761c090/cmd/localCI/repo.go#L345-L397)
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 revision used in defer or goroutine at line 383
[Click here to see the code in its original context.](https://github.com/clearcontainers/tests/blob/21e54715679c48a0ac2c695f81d7d63a5761c090/cmd/localCI/repo.go#L345-L397)
Click here to show the 53 line(s) of Go which triggered the analyzer.
```go
for _, revision := range revisions {
tested, ok := (*revisionsTested)[revision.id()]
if ok {
// checking if the old version of the PR is being tested
if tested.isBeingTested() {
r.logger.Debugf("revision is being tested: %#v", tested)
continue
}
if revision.equal(tested) {
r.logger.Debugf("revision was already tested: %#v", revision)
continue
}
}
// check if the revision can be tested
if err := revision.canBeTested(); err != nil {
r.logger.Debugf("revision %s cannot be tested: %s", revision.id(), err)
continue
}
// setup revision
langEnv, err := r.setupRevision(revision)
if err != nil {
r.logger.Errorf("failed to setup revision %#v: %s", revision, err)
continue
}
// cleanup revision
defer func() {
err = langEnv.cleanup()
if err != nil {
r.logger.Error(err)
}
}()
// test revision
if runTestsInParallel {
go func() {
if err := r.testRevision(revision, langEnv); err != nil {
r.logger.Errorf("failed to test revision %#v %s", revision, err)
}
}()
} else {
testLock.Lock()
if err := r.testRevision(revision, langEnv); err != nil {
r.logger.Errorf("failed to test revision %#v %s", revision, err)
}
testLock.Unlock()
}
// copy the PR that was tested
(*revisionsTested)[revision.id()] = revision
}
```
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: 21e54715679c48a0ac2c695f81d7d63a5761c090
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.