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

vultr/terraform-provider-vultr: vultr/data_source_vultr_reverse_ipv6.go; 15 LoC

Open
#14,497 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 [vultr/terraform-provider-vultr](https://www.github.com/vultr/terraform-provider-vultr) at [vultr/data_source_vultr_reverse_ipv6.go](https://github.com/vultr/terraform-provider-vultr/blob/a7b8ba36468df6b22464d1869eb8430236500525/vultr/data_source_vultr_reverse_ipv6.go#L97-L111)

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 reverseIPV6 is reassigned at line 108

[Click here to see the code in its original context.](https://github.com/vultr/terraform-provider-vultr/blob/a7b8ba36468df6b22464d1869eb8430236500525/vultr/data_source_vultr_reverse_ipv6.go#L97-L111)

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

```go
for _, reverseIPV6 := range reverseIPV6s {
m, err := structToMap(reverseIPV6)
if err != nil {
return err
}

if filterLoop(filter, m) {
if result != nil {
return fmt.Errorf("your search returned too many results - please refine your search to be more specific")
}

result = &reverseIPV6
resultInstanceID = instanceID
}
}

```

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: a7b8ba36468df6b22464d1869eb8430236500525

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with vultr/data_source_vultr_reverse_ipv6.go around lines 97-111 and inspect how the selected result is retained after the range loop. Confirm whether the analyzer finding represents a bug, mitigation, or desirable behavior, then leave the corresponding reaction on the issue; done means the classification is supported by the surrounding code.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.