BewareMyPower commented on code in PR #1437:
URL: https://github.com/apache/pulsar-client-go/pull/1437#discussion_r2533945238


##########
pulsar/producer_impl.go:
##########
@@ -277,8 +280,8 @@ func (p *producer) internalCreatePartitionsProducers() 
error {
        } else {
                p.metrics.ProducersPartitions.Add(float64(partitionsToAdd))
        }
-       atomic.StorePointer(&p.producersPtr, unsafe.Pointer(&p.producers))
-       atomic.StoreUint32(&p.numPartitions, uint32(len(p.producers)))
+       atomic.StorePointer(&p.producersPtr, unsafe.Pointer(&producers))

Review Comment:
   https://pkg.go.dev/unsafe#Pointer
   
   > Pointer therefore allows a program to defeat the type system and read and 
write arbitrary memory. It should be used with extreme care.
   >
   > The following patterns involving Pointer are valid. Code not using these 
patterns is likely to be invalid today or to become invalid in the future. Even 
the valid patterns below come with important caveats.
   
   It's dangerous to use `unsafe.Pointer` in such cases no matter if it's safe 
with the current Golang implementation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to