You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because gorm uses chainable API, calling db.Func() will return a *DB pointer, so if no s.clone(), user will get two pointers, the original *db and the returned *db, which actually point to the same object.
It is dangerous and may cause some concurrent problems.
Sorry for opening up that topic again, but I started reading through the Gorm code and it seems like you might benefit from just letting the runtime copy, instead of the library doing it manually. If you use a non-pointer receiver you'll obtain a new copy every time, and still benefit from the chaining.
What is the reason?
The text was updated successfully, but these errors were encountered: