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

istio/old_pilot_repo: test/integration/driver.go; 83 LoC

Open
#14,865 0 comments 0 reactions 0 assignees View on GitHub
fresh medium
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [istio/old_pilot_repo](https://www.github.com/istio/old_pilot_repo) at [test/integration/driver.go](https://github.com/istio/old_pilot_repo/blob/328700a0b55e097df7490e1fa7a0afdc24d80828/test/integration/driver.go#L184-L266)

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 istio was used in a composite literal at line 204

[Click here to see the code in its original context.](https://github.com/istio/old_pilot_repo/blob/328700a0b55e097df7490e1fa7a0afdc24d80828/test/integration/driver.go#L184-L266)

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

```go
for _, istio := range envs {
var errs error
log("Deploying infrastructure", spew.Sdump(istio))
if err := istio.setup(); err != nil {
result = multierror.Append(result, err)
continue
}
if err := istio.deployApps(); err != nil {
result = multierror.Append(result, err)
continue
}

nslist := []string{istio.IstioNamespace, istio.Namespace}
istio.apps, errs = util.GetAppPods(client, nslist)
if errs != nil {
result = multierror.Append(result, errs)
break
}

tests := []test{
&http{infra: &istio},
&grpc{infra: &istio},
&tcp{infra: &istio},
&headless{infra: &istio},
&ingress{infra: &istio},
&egressRules{infra: &istio},
&routing{infra: &istio},
&zipkin{infra: &istio},
}

for _, test := range tests {
// If the user has specified a test, skip all other tests
if len(testType) > 0 && testType != test.String() {
continue
}

for i := 0; i < count; i++ {
log("Test run", strconv.Itoa(i))
if err := test.setup(); err != nil {
errs = multierror.Append(errs, multierror.Prefix(err, test.String()))
} else {
log("Running test", test.String())
if err := test.run(); err != nil {
errs = multierror.Append(errs, multierror.Prefix(err, fmt.Sprintf("%v run %d", test, i)))
} else {
log("Success!", test.String())
}
}
log("Tearing down test", test.String())
test.teardown()
}
}

// spill all logs on error
if errs != nil {
for _, pod := range util.GetPods(client, istio.Namespace) {
if strings.HasPrefix(pod, "istio-pilot") {
log("Discovery log", pod)
glog.Info(util.FetchLogs(client, pod, istio.IstioNamespace, "discovery"))
} else if strings.HasPrefix(pod, "istio-mixer") {
log("Mixer log", pod)
glog.Info(util.FetchLogs(client, pod, istio.IstioNamespace, "mixer"))
} else if strings.HasPrefix(pod, "istio-ingress") {
log("Ingress log", pod)
glog.Info(util.FetchLogs(client, pod, istio.IstioNamespace, inject.ProxyContainerName))
} else {
log("Proxy log", pod)
glog.Info(util.FetchLogs(client, pod, istio.Namespace, inject.ProxyContainerName))
}
}
}

// always remove infra even if the tests fail
log("Tearing down infrastructure", istio.Name)
istio.teardown()

if errs == nil {
log("Passed all tests!", fmt.Sprintf("tests: %v, count: %d", tests, count))
} else {
logError("Failed tests!", errs.Error())
result = multierror.Append(result, multierror.Prefix(errs, istio.Name))
}
}

```

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: 328700a0b55e097df7490e1fa7a0afdc24d80828

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.