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

pennmanor/kayako-mattermost-bot: kayako-mattermost-notifier.go; 6 LoC

Open
#15,677 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 [pennmanor/kayako-mattermost-bot](https://www.github.com/pennmanor/kayako-mattermost-bot) at [kayako-mattermost-notifier.go](https://github.com/pennmanor/kayako-mattermost-bot/blob/eccdcec0dccb7072c3541b15217e121af39b481d/kayako-mattermost-notifier.go#L90-L95)

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

[Click here to see the code in its original context.](https://github.com/pennmanor/kayako-mattermost-bot/blob/eccdcec0dccb7072c3541b15217e121af39b481d/kayako-mattermost-notifier.go#L90-L95)

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

```go
for key, t := range oldTickets {
if _, found := newTickets[key]; !found {
msg := gomm.IncomingWebhookRequest{Text: fmt.Sprintf("Closed %v", buildTicketString(&client, &t)), Username: "kayako"}
c <- msg
}
}

```

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: eccdcec0dccb7072c3541b15217e121af39b481d

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at kayako-mattermost-notifier.go lines 90-95 and read the surrounding oldTickets/newTickets loop. Reproduce or reason about the analyzer finding involving the range variable, then inspect the bot’s closed-ticket notification path for existing verification. Done means the finding is addressed without changing the intended closed-ticket message behavior.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.