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

ghetzel/qcat: client.go; 25 LoC

Open
#13,489 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [ghetzel/qcat](https://www.github.com/ghetzel/qcat) at [client.go](https://github.com/ghetzel/qcat/blob/4d691c2458928974b5d0906a942d73b13ceb457e/client.go#L381-L405)

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

[Click here to see the code in its original context.](https://github.com/ghetzel/qcat/blob/4d691c2458928974b5d0906a942d73b13ceb457e/client.go#L381-L405)

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

```go
for delivery := range msgs {
var deliveryMode DeliveryMode

switch delivery.DeliveryMode {
case 2:
deliveryMode = Persistent
default:
deliveryMode = Transient
}

self.outchan <- &Message{
delivery: &delivery,
channel: self.channel,
ackRequired: !self.AutoAck,
Timestamp: delivery.Timestamp,
Body: delivery.Body,
Header: MessageHeader{
ContentType: delivery.ContentType,
ContentEncoding: delivery.ContentEncoding,
DeliveryMode: deliveryMode,
Priority: int(delivery.Priority),
Headers: typeutil.MapNative(delivery.Headers),
},
}
}

```

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: 4d691c2458928974b5d0906a942d73b13ceb457e

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.