github-vet / github-vet/rangeloop-pointer-findings
justmiles/go-get-ssm-params: main.go; 34 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [justmiles/go-get-ssm-params](https://www.github.com/justmiles/go-get-ssm-params) at [main.go](https://github.com/justmiles/go-get-ssm-params/blob/3616007c3fd6d31ba307630e3595e166dcc08ae0/main.go#L64-L97)
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 ssmPath was used in a composite literal at line 66
[Click here to see the code in its original context.](https://github.com/justmiles/go-get-ssm-params/blob/3616007c3fd6d31ba307630e3595e166dcc08ae0/main.go#L64-L97)
Click here to show the 34 line(s) of Go which triggered the analyzer.
```go
for _, ssmPath := range ssmPaths {
ssmOpts := ssm.GetParametersByPathInput{
Path: &ssmPath,
WithDecryption: &ssmOptionWithDecryption,
MaxResults: &ssmOptionMaxResults,
}
// Loop through the SSM GetParametersByPathInput call until Pagination is complete
for {
// consume pagination NextToken if exists
if ssmOptionNextToken != "" {
ssmOpts.NextToken = &ssmOptionNextToken
}
// perform the request
ssmResponse, err := svc.GetParametersByPath(&ssmOpts)
check(err)
// range over response and store results in memory
for _, parameter := range ssmResponse.Parameters {
s := strings.Split(*parameter.Name, "/")
key := s[len(s)-1]
output[key] = *parameter.Value
}
// if pagination NextToken exists, set it and continue loop. otherwise break loop
if ssmResponse.NextToken != nil {
ssmOptionNextToken = *ssmResponse.NextToken
} else {
ssmOptionNextToken = ""
break
}
}
}
```
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: 3616007c3fd6d31ba307630e3595e166dcc08ae0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.