github-vet / github-vet/rangeloop-pointer-findings
tktip/fiks-bekymringsmelding-konsument: internal/fiks/fiksamq.go; 17 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [tktip/fiks-bekymringsmelding-konsument](https://www.github.com/tktip/fiks-bekymringsmelding-konsument) at [internal/fiks/fiksamq.go](https://github.com/tktip/fiks-bekymringsmelding-konsument/blob/a46628c9aaf33aa79be7ac125dd0de8eb99f08fe/internal/fiks/fiksamq.go#L224-L240)
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 message was used in a composite literal at line 226
[Click here to see the code in its original context.](https://github.com/tktip/fiks-bekymringsmelding-konsument/blob/a46628c9aaf33aa79be7ac125dd0de8eb99f08fe/internal/fiks/fiksamq.go#L224-L240)
Click here to show the 17 line(s) of Go which triggered the analyzer.
```go
for message := range queue {
fiksMsg := fiksMessage{&message}
log := fiksMsg.LoggerWithFields()
err = h.handleAMQMessage(fiksMsg)
if err != nil {
log.Errorf("Failed to handle AMQP message: %s", fiksMsg.GetMeldingID(), err)
} else {
log.Infof("Successfully handled message")
}
// Always ack.
//TODO: Consider alternate processing on errors
// I.e. if report failure fails.
message.Ack(true)
}
```
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: a46628c9aaf33aa79be7ac125dd0de8eb99f08fe
Contributor guide
No contributing guide indexed for this repository
Research direction
Read internal/fiks/fiksamq.go around lines 224-240 and the linked context in tktip/fiks-bekymringsmelding-konsument. Check how the range-loop variable is referenced in the fiksMessage composite literal and whether that creates the reported issue. Done means classifying the finding as Bug, Mitigated, or Desirable Behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100