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 newSpecProp was used in a composite literal at line 309
Click here to show the 18 line(s) of Go which triggered the analyzer.
```go
for _, newSpecProp := range newSpecProps {
if newSpecProp.ReadOnly != nil && !*newSpecProp.ReadOnly {
var staleSpecProp = staleSpecPropsIndex[newSpecProp.Name]
// publishes again if changed
if !reflect.DeepEqual(staleSpecProp, newSpecProp) {
var err = d.mqttClient.Publish(mqtt.PublishMessage{
Render: getPublishRender(&newSpecProp),
QoSPointer: (*byte)(newSpecProp.QoS),
RetainedPointer: newSpecProp.Retained,
Payload: newSpecProp.Value,
})
if err != nil {
return errors.Wrapf(err, "failed to publish property %s", newSpecProp.Name)
}
d.log.V(4).Info("Sent payload", "type", "AttributedTopic", "property", newSpecProp.Name)
}
}
}
```
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 for more information.
Found a possible issue in cnrancher/octopus at adaptors/mqtt/pkg/physical/device.go
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.
Click here to see the code in its original context.
Click here to show the 18 line(s) of Go which triggered the analyzer.
```go for _, newSpecProp := range newSpecProps { if newSpecProp.ReadOnly != nil && !*newSpecProp.ReadOnly { var staleSpecProp = staleSpecPropsIndex[newSpecProp.Name] // publishes again if changed if !reflect.DeepEqual(staleSpecProp, newSpecProp) { var err = d.mqttClient.Publish(mqtt.PublishMessage{ Render: getPublishRender(&newSpecProp), QoSPointer: (*byte)(newSpecProp.QoS), RetainedPointer: newSpecProp.Retained, Payload: newSpecProp.Value, }) if err != nil { return errors.Wrapf(err, "failed to publish property %s", newSpecProp.Name) } d.log.V(4).Info("Sent payload", "type", "AttributedTopic", "property", newSpecProp.Name) } } } ```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 for more information.
commit ID: 3793775c1da67af923abfe79660e9d8055b262b3