github-vet / github-vet/rangeloop-pointer-findings
4dinterface2/GQLMerge: stiching/json_merge.go; 7 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [4dinterface2/GQLMerge](https://www.github.com/4dinterface2/GQLMerge) at [stiching/json_merge.go](https://github.com/4dinterface2/GQLMerge/blob/be0bd8ed543bd068de7e88ac9fc9b9cb2ca67ec3/stiching/json_merge.go#L18-L24)
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 srcVal is reassigned at line 22
[Click here to see the code in its original context.](https://github.com/4dinterface2/GQLMerge/blob/be0bd8ed543bd068de7e88ac9fc9b9cb2ca67ec3/stiching/json_merge.go#L18-L24)
Click here to show the 7 line(s) of Go which triggered the analyzer.
```go
for key, srcVal := range (*src).(map[string]interface{}) { //TODO не факт что в src map
if dstVal, ok:= target[key]; ok {
target[key] = merge(dstVal, &srcVal )
} else {
target[key] = &srcVal //копируем ссылку
}
}
```
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: be0bd8ed543bd068de7e88ac9fc9b9cb2ca67ec3
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with stiching/json_merge.go lines 18-24 and inspect the surrounding merge behavior. Determine whether the references to the range variable represent a bug, a mitigated case, or desirable behavior, then leave the corresponding reaction; completion is the classification reaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100