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

integr8ly/managed-service-broker: tests/test_suites/broker/operations.go; 4 LoC

Open
#17,911 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [integr8ly/managed-service-broker](https://www.github.com/integr8ly/managed-service-broker) at [tests/test_suites/broker/operations.go](https://github.com/integr8ly/managed-service-broker/blob/2743613163e0532898fe2c68ab76a0e0efbb3bcb/tests/test_suites/broker/operations.go#L11-L14)

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.

> function call which takes a reference to p at line 12 may start a goroutine

[Click here to see the code in its original context.](https://github.com/integr8ly/managed-service-broker/blob/2743613163e0532898fe2c68ab76a0e0efbb3bcb/tests/test_suites/broker/operations.go#L11-L14)

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

```go
for _, p := range tc.Service.Plans {
TestProvision(t, tc, &p, sbc)
TestDeprovision(t, tc, &p, sbc)
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(Get, 3)" -> {"(Do, 3)";}
"(Do, 3)" -> {}
"(get, 1)" -> {"(SetTransportDefaults, 1)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(New, 1)" -> {"(Read, 2)";"(get, 1)";}
"(Read, 2)" -> {"(read, 2)";}
"(read, 2)" -> {"(Get, 3)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(TestProvision, 4)" -> {"(confirmLastOperation, 5)";}
"(confirmLastOperation, 5)" -> {"(PollLastOperation, 4)";}
"(PollLastOperation, 4)" -> {"(New, 1)";}
}

```

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: 2743613163e0532898fe2c68ab76a0e0efbb3bcb

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in tests/test_suites/broker/operations.go at the loop around lines 11–14, then inspect TestProvision and TestDeprovision and the analyzer call graph. Determine whether passing the range variable reference can cause incorrect behavior, and verify the result with the repository's existing test suite or a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.