github-vet / github-vet/rangeloop-pointer-findings
kopaing99/kopaing9: pkg/state/state_exec_tmpl.go; 28 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [kopaing99/kopaing9](https://www.github.com/kopaing99/kopaing9) at [pkg/state/state_exec_tmpl.go](https://github.com/kopaing99/kopaing9/blob/ada5f05b36b69d1b893cf6c438cd37e2eff0c614/pkg/state/state_exec_tmpl.go#L104-L131)
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 rt is reassigned at line 106
[Click here to see the code in its original context.](https://github.com/kopaing99/kopaing9/blob/ada5f05b36b69d1b893cf6c438cd37e2eff0c614/pkg/state/state_exec_tmpl.go#L104-L131)
Click here to show the 28 line(s) of Go which triggered the analyzer.
```go
for i, rt := range st.Releases {
successFlag := false
for it, prev := 0, &rt; it < 6; it++ {
tmplData := releaseTemplateData{
Environment: st.Env,
Release: *prev,
Values: vals,
}
renderer := tmpl.NewFileRenderer(st.readFile, st.basePath, tmplData)
r, err := rt.ExecuteTemplateExpressions(renderer)
if err != nil {
return nil, fmt.Errorf("failed executing templates in release \"%s\".\"%s\": %v", st.FilePath, rt.Name, err)
}
if reflect.DeepEqual(prev, r) {
successFlag = true
if err := updateBoolTemplatedValues(r); err != nil {
return nil, fmt.Errorf("failed executing templates in release \"%s\".\"%s\": %v", st.FilePath, rt.Name, err)
}
st.Releases[i] = *r
break
}
prev = r
}
if !successFlag {
return nil, fmt.Errorf("failed executing templates in release \"%s\".\"%s\": %s", st.FilePath, rt.Name,
"recursive references can't be resolved")
}
}
```
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: ada5f05b36b69d1b893cf6c438cd37e2eff0c614
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.