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

devspace-cloud/devspace: e2e/tests/enter/enter.go; 34 LoC

Open
#14,709 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 [devspace-cloud/devspace](https://www.github.com/devspace-cloud/devspace) at [e2e/tests/enter/enter.go](https://github.com/devspace-cloud/devspace/blob/09876340af417c1c44d7804beb7a072ce812d504/e2e/tests/enter/enter.go#L47-L80)

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 subTestName used in defer or goroutine at line 53

[Click here to see the code in its original context.](https://github.com/devspace-cloud/devspace/blob/09876340af417c1c44d7804beb7a072ce812d504/e2e/tests/enter/enter.go#L47-L80)

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

```go
for _, subTestName := range subTests {
f.ResetLog()
c1 := make(chan error)

go func() {
err := func() error {
f.Namespace = utils.GenerateNamespaceName("test-enter-" + subTestName)

err := beforeTest(f)
defer afterTest(f)
if err != nil {
return errors.Errorf("test 'enter' failed: %s %v", f.GetLogContents(), err)
}

err = availableSubTests[subTestName](f, logger)
utils.PrintTestResult("enter", subTestName, err, logger)
if err != nil {
return errors.Errorf("test 'enter' failed: %s %v", f.GetLogContents(), err)
}

return nil
}()
c1 <- err
}()

select {
case err := <-c1:
if err != nil {
return err
}
case <-time.After(time.Duration(timeout) * time.Second):
return errors.Errorf("Timeout error - the test did not return within the specified timeout of %v seconds: %s", timeout, f.GetLogContents())
}
}

```

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: 09876340af417c1c44d7804beb7a072ce812d504

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.