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

zhouliang3/ctg_uconf_agent: src/ctg.com/bak/uconf/agent/main.go; 13 LoC

Open
#17,372 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 [zhouliang3/ctg_uconf_agent](https://www.github.com/zhouliang3/ctg_uconf_agent) at [src/ctg.com/bak/uconf/agent/main.go](https://github.com/zhouliang3/ctg_uconf_agent/blob/4802b4dff8fecd518507ff761f8c1d7e99649fdb/src/ctg.com/bak/uconf/agent/main.go#L53-L65)

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 appCfg used in defer or goroutine at line 58

[Click here to see the code in its original context.](https://github.com/zhouliang3/ctg_uconf_agent/blob/4802b4dff8fecd518507ff761f8c1d7e99649fdb/src/ctg.com/bak/uconf/agent/main.go#L53-L65)

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

```go
for _, appCfg := range agentConfig.Apps {
latch.Add(1)
go func() {
fmt.Println("启动应用线程。。。。", time.Now())
//构造app实例
appInstance := app.NewInstance(machine.Ip, machine.HoseName, appCfg.Dir)
loadAppInfoByKey(&appCfg, appInstance)

//需要根据app的信息从配置中心获取此app所有的配置文件列表,然后,依次处理这些文件,并监听配置文件列表的变化
appFilelistLoad(appInstance)
latch.Done()
}()
}

```

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: 4802b4dff8fecd518507ff761f8c1d7e99649fdb

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.