RedisGraph / redisgraph-go

A Golang client for redisgraph
https://redisgraph.io
BSD 3-Clause "New" or "Revised" License
132 stars 38 forks source link

Fix mutex passed by value warning #57

Closed jeffreylovitz closed 3 years ago

jeffreylovitz commented 3 years ago

Since the Graph struct contains a mutex, misbehaviors can occur if this struct is copied by pass-by-value returns. GraphNew instantiates and returns a Graph value, but this is safe because no other copies of the object exist.

The DeepSource complaint can be simply avoided by returning the new Graph struct directly rather than assigning it to a local variable first.