github-vet / github-vet/rangeloop-pointer-findings
fabric8io/gofabric8: cmds/environ.go; 15 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [fabric8io/gofabric8](https://www.github.com/fabric8io/gofabric8) at [cmds/environ.go](https://github.com/fabric8io/gofabric8/blob/037dd8f7a18ab66184a8bb0d98f031ecbdeb7ebd/cmds/environ.go#L187-L201)
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 item was used in a composite literal at line 196
[Click here to see the code in its original context.](https://github.com/fabric8io/gofabric8/blob/037dd8f7a18ab66184a8bb0d98f031ecbdeb7ebd/cmds/environ.go#L187-L201)
Click here to show the 15 line(s) of Go which triggered the analyzer.
```go
for _, item := range cfgmap.Items {
for k, data := range item.Data {
var ed EnvironmentData
err := yaml.Unmarshal([]byte(data), &ed)
cmdutil.CheckErr(err)
if strings.ToLower(ed.Name) == strings.ToLower(toDeleteEnv) {
delete(item.Data, k)
updatedCfgMap = &item
goto DeletedConfig
}
}
}
```
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: 037dd8f7a18ab66184a8bb0d98f031ecbdeb7ebd
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cmds/environ.go lines 187-201 and inspect the surrounding command flow. Check whether the reference to the range variable in updatedCfgMap is intended, then classify the finding as Bug, Mitigated, or Desirable Behavior with the corresponding reaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100