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

MrXiaoZ/linux-system-manage: xenserver/vm-create.go; 5 LoC

Open
#16,741 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 [MrXiaoZ/linux-system-manage](https://www.github.com/MrXiaoZ/linux-system-manage) at [xenserver/vm-create.go](https://github.com/MrXiaoZ/linux-system-manage/blob/2eafc7af4b4162510b280a7f29c0ca964e3fc5ca/xenserver/vm-create.go#L40-L44)

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 vms is reassigned at line 41

[Click here to see the code in its original context.](https://github.com/MrXiaoZ/linux-system-manage/blob/2eafc7af4b4162510b280a7f29c0ca964e3fc5ca/xenserver/vm-create.go#L40-L44)

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

```go
for _ , vms := range vmsinfo {
p_v := &vms
fmt.Println(p_v.Vms_ip)
models.AddVmsInstance(*tpl , p_v.Vms_instance , p_v.Vms_uuid , p_v.Vms_ip)
}

```

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: 2eafc7af4b4162510b280a7f29c0ca964e3fc5ca

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect xenserver/vm-create.go around lines 40-44 and read the range-loop analyzer finding. Trace how vmsinfo is iterated and how models.AddVmsInstance uses the loop values, then compare the behavior with the intended handling of each VM. Done means the reported issue is confirmed or dismissed with a project-appropriate regression check or explanation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.