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

ld778585/myMqant: src/github.com/hashicorp/consul/agent/proxycfg/manager.go; 3 LoC

Open
#9,681 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 [ld778585/myMqant](https://www.github.com/ld778585/myMqant) at [src/github.com/hashicorp/consul/agent/proxycfg/manager.go](https://github.com/ld778585/myMqant/blob/3ecd0c108dc571f98359bd5a2f52a21fd03315e7/src/github.com/hashicorp/consul/agent/proxycfg/manager.go#L205-L207)

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 snap at line 206 may start a goroutine

[Click here to see the code in its original context.](https://github.com/ld778585/myMqant/blob/3ecd0c108dc571f98359bd5a2f52a21fd03315e7/src/github.com/hashicorp/consul/agent/proxycfg/manager.go#L205-L207)

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

```go
for snap := range ch {
m.notify(&snap)
}

```

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 {
"(writeMsg, 4)" -> {"(formatJson, 5)";}
"(New, 0)" -> {}
"(marshalValue, 3)" -> {"(write, 1)";}
"(genMessage, 3)" -> {"(genMessageFields, 3)";}
"(genMessageInternalFields, 4)" -> {"(append, 1)";}
"(genMessageField, 5)" -> {"(append, 1)";}
"(Sum, 1)" -> {"(update, 2)";"(Write, 1)";}
"(NewNetTransport, 1)" -> {}
"(handleReload, 2)" -> {"(ReloadConfig, 1)";}
"(append, 1)" -> {}
"(encoderOfMap, 2)" -> {"(append, 1)";}
"(write, 1)" -> {"(Add, 1)";}
"(reloadWatches, 1)" -> {}
"(encoderOfMapKey, 2)" -> {"(encoderOfType, 2)";}
"(createEncoderOfType, 2)" -> {"(_createEncoderOfType, 2)";}
"(createEncoderOfNative, 2)" -> {"(decoderOfSlice, 2)";}
"(describeStruct, 2)" -> {"(append, 1)";}
"(encoderOfArray, 2)" -> {"(append, 1)";}
"(run, 1)" -> {"(startupUpdateCheck, 1)";"(handleReload, 2)";}
"(CheckInterval, 3)" -> {}
"(Encode, 2)" -> {"(encoderOfMapKey, 2)";}
"(encoderOfType, 2)" -> {"(createEncoderOfType, 2)";}
"(query, 1)" -> {}
"(_createEncoderOfType, 2)" -> {"(encoderOfSlice, 2)";"(encoderOfMap, 2)";"(createEncoderOfNative, 2)";"(encoderOfStruct, 2)";"(encoderOfArray, 2)";}
"(AddService, 1)" -> {"(RegisterAndStart, 5)";}
"(deliverLatest, 2)" -> {"(Error, 3)";}
"(Error, 3)" -> {"(writeMsg, 4)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(Add, 1)" -> {"(New, 0)";}
"(set, 3)" -> {"(New, 2)";}
"(decoderOfSlice, 2)" -> {"(append, 1)";}
"(RegisterAndStart, 5)" -> {"(start, 2)";}
"(init, 0)" -> {"(New, 2)";"(Create, 1)";"(Run, 1)";"(GenerateFile, 2)";"(NewCoordinate, 2)";"(New, 0)";}
"(NewClient, 1)" -> {"(NewClientLogger, 3)";}
"(GenerateFile, 2)" -> {"(genMessage, 3)";}
"(Encode, 1)" -> {"(New, 1)";"(Write, 1)";"(Sum, 1)";"(encode, 1)";"(marshalValue, 3)";"(Encode, 2)";}
"(Set, 2)" -> {"(New, 2)";"(set, 3)";"(init, 0)";}
"(encode, 1)" -> {"(Write, 1)";"(Encode, 2)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(loadServices, 2)" -> {"(addServiceLocked, 2)";}
"(Marshal, 1)" -> {"(Encode, 1)";"(marshalStruct, 2)";}
"(NewCoordinate, 2)" -> {}
"(encoderOfStruct, 2)" -> {"(describeStruct, 2)";}
"(notify, 1)" -> {"(deliverLatest, 2)";}
"(Write, 1)" -> {"(Set, 2)";"(Query, 1)";"(Encode, 2)";"(New, 1)";"(Add, 1)";}
"(Query, 1)" -> {"(query, 1)";}
"(Create, 1)" -> {"(newMemberlist, 1)";"(newSerfQueries, 4)";"(NewSnapshotter, 7)";"(NewClient, 1)";}
"(Set, 1)" -> {"(Set, 2)";}
"(update, 2)" -> {"(Add, 1)";}
"(newMemberlist, 1)" -> {"(NewNetTransport, 1)";}
"(run, 2)" -> {}
"(startupUpdateCheck, 1)" -> {"(CheckInterval, 3)";}
"(monitor, 4)" -> {}
"(encoderOfSlice, 2)" -> {"(append, 1)";}
"(New, 2)" -> {"(NewClient, 1)";}
"(get, 1)" -> {"(run, 1)";"(SetTransportDefaults, 1)";}
"(NewClientLogger, 3)" -> {}
"(MonitorJSON, 3)" -> {"(monitor, 4)";}
"(addServiceLocked, 2)" -> {"(AddService, 1)";}
"(formatJson, 5)" -> {"(Marshal, 1)";}
"(New, 1)" -> {"(init, 0)";"(Add, 1)";"(get, 1)";}
"(newSerfQueries, 4)" -> {}
"(NewSnapshotter, 7)" -> {}
"(NewAgentConfigWatcher, 3)" -> {}
"(genMessageFields, 3)" -> {"(genMessageInternalFields, 4)";"(genMessageField, 5)";}
"(marshalStruct, 2)" -> {"(Write, 1)";"(Set, 1)";}
"(Run, 1)" -> {"(Monitor, 3)";"(run, 2)";"(ForwardSignals, 3)";"(run, 1)";"(configWatcher, 1)";"(MonitorJSON, 3)";}
"(ForwardSignals, 3)" -> {}
"(configWatcher, 1)" -> {"(NewAgentConfigWatcher, 3)";}
"(Monitor, 3)" -> {"(monitor, 4)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(ReloadConfig, 1)" -> {"(reloadWatches, 1)";"(loadServices, 2)";}
"(start, 2)" -> {}
}

```

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: 3ecd0c108dc571f98359bd5a2f52a21fd03315e7

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.