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

tencentcloudstack/terraform-provider-tencentcloud: tencentcloud/service_tencentcloud_api_gateway.go; 38 LoC

Open
#8,361 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 [tencentcloudstack/terraform-provider-tencentcloud](https://www.github.com/tencentcloudstack/terraform-provider-tencentcloud) at [tencentcloud/service_tencentcloud_api_gateway.go](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/blob/111f4472f70f74f18a7ba465038d4e0d5edc3a78/tencentcloud/service_tencentcloud_api_gateway.go#L1376-L1413)

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 env is reassigned at line 1381

[Click here to see the code in its original context.](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/blob/111f4472f70f74f18a7ba465038d4e0d5edc3a78/tencentcloud/service_tencentcloud_api_gateway.go#L1376-L1413)

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

```go
for _, env := range API_GATEWAY_SERVICE_ENVS {
request := apigateway.NewDescribeIPStrategyRequest()

request.ServiceId = &serviceId
request.StrategyId = &strategyId
request.EnvironmentName = &env

var (
limit int64 = 100
offset int64 = 0
)

request.Limit = &limit
request.Offset = &offset

for {
ratelimit.Check(request.GetAction())
response, err := me.client.UseAPIGatewayClient().DescribeIPStrategy(request)
if err != nil {
errRet = err
return
}
if response.Response.Result == nil {
errRet = fmt.Errorf("TencentCloud SDK %s return empty response", request.GetAction())
return
}
if len(response.Response.Result.BindApis) > 0 {
apiList = append(apiList, response.Response.Result.BindApis...)
}
if len(response.Response.Result.BindApis) < int(limit) {
has = true
ipStrategies = response.Response.Result
ipStrategies.BindApis = apiList
return
}
offset += limit
}
}

```

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: 111f4472f70f74f18a7ba465038d4e0d5edc3a78

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.