github-vet / github-vet/rangeloop-pointer-findings
therocode/CppCompilerCompliance: main.go; 69 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [therocode/CppCompilerCompliance](https://www.github.com/therocode/CppCompilerCompliance) at [main.go](https://github.com/therocode/CppCompilerCompliance/blob/d551c3ba6a8989a610ccbe028e4330f52503e170/main.go#L213-L281)
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.
> function call at line 250 may store a reference to entry
[Click here to see the code in its original context.](https://github.com/therocode/CppCompilerCompliance/blob/d551c3ba6a8989a610ccbe028e4330f52503e170/main.go#L213-L281)
Click here to show the 69 line(s) of Go which triggered the analyzer.
```go
for _, entry := range unreportedEntries {
previous, err := complianceStorageService.GetPreviousFeatureEntry(context.Background(), &entry)
if err != nil {
log.Printf("error when getting previous feature entry: %v\n", err)
continue
}
twitterReport, err := compliance.FeatureToTwitterReport(previous, &entry)
if err != nil {
log.Printf("not capable of turning update into report. will try to report this as private tweet: %v\n", err)
if entry.ReportedBroken {
log.Printf("this error is already reported, skip entry\n")
continue
}
message := fmt.Sprintf("Hello! There was an issue with a change on cppreference that I don't know how to turn into a report.\nThe involved entries are '%v' '%v' and '%v' '%v'. \nFull expansion of those:\n\n%v\n\n%v", previous.Name, previous.Timestamp, entry.Name, entry.Timestamp, previous, entry)
//directmessage, httpresponse, err
_, _, err = client.DirectMessages.EventsNew(&twitter.DirectMessageEventsNewParams{
Event: &twitter.DirectMessageEvent{
Type: "message_create",
Message: &twitter.DirectMessageEventMessage{
Target: &twitter.DirectMessageTarget{
RecipientID: cfg.MaintainerTwitterId,
},
Data: &twitter.DirectMessageData{
Text: message,
},
},
},
})
if err != nil {
log.Printf("did not manage to report by twitter pm that I couldn't report to twitter: %v\n", err)
} else {
log.Printf("error report sent.\n")
complianceStorageService.SetErrorReported(context.Background(), &entry)
}
continue
}
if !cfg.SupressReporting {
messagePrefix := "Dry run: "
//tweet, resp, err
if !cfg.DryReporting && twitterReport != "" { //do not post if we do dry run or message is empty
_, _, err = client.Statuses.Update(twitterReport, nil)
messagePrefix = ""
}
if twitterReport != "" {
log.Printf(messagePrefix+"posting tweet: %v\n", twitterReport)
} else {
log.Printf(messagePrefix + "found change that I don't care about. setting as reported.\n")
}
if err != nil {
log.Printf("error posting tweet update: %v\n", err)
continue
} else {
if !cfg.DryReporting {
complianceStorageService.SetTwitterReported(context.Background(), &entry)
}
}
} else {
log.Printf("got twitter report which will be supressed: %v\n", twitterReport)
complianceStorageService.SetTwitterReported(context.Background(), &entry)
}
}
```
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: d551c3ba6a8989a610ccbe028e4330f52503e170
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.