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

iKuiki/wwdk: sync.go; 9 LoC

Open
#17,541 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [iKuiki/wwdk](https://www.github.com/iKuiki/wwdk) at [sync.go](https://github.com/iKuiki/wwdk/blob/25b10de79782984c3f97755000ab9030e5536fa9/sync.go#L50-L58)

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 contact was used in a composite literal at line 55

[Click here to see the code in its original context.](https://github.com/iKuiki/wwdk/blob/25b10de79782984c3f97755000ab9030e5536fa9/sync.go#L50-L58)

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

```go
for _, contact := range modContacts {
wxwb.runInfo.ContactModifyCount++
wxwb.logger.Infof("Modify contact: %s\n", contact.NickName)
syncChannel <- SyncChannelItem{
Code: SyncStatusModifyContact,
Contact: &contact,
}
wxwb.userInfo.contactList[contact.UserName] = contact
}

```

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: 25b10de79782984c3f97755000ab9030e5536fa9

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with sync.go at lines 50-58 and inspect SyncChannelItem.Contact plus the downstream use of modContacts. Verify whether taking a reference to the range variable affects queued items across iterations, then classify the finding as a bug, mitigated, or desirable behavior; done means the behavior and any needed correction are confirmed.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.