core: avoid lock copy in private DAO constructor

Fix the following linter warning:
```
pkg/core/dao/dao.go:101:7  govet  copylocks: assignment copies lock value to *d: github.com/nspcc-dev/neo-go/pkg/core/dao.Simple contains sync.RWMutex
```
This commit is contained in:
Anna Shaleva 2022-04-20 18:42:49 +03:00
parent 8d2d48f360
commit a6a0c1eb12

View file

@ -92,8 +92,11 @@ func (dao *Simple) GetWrapped() *Simple {
// GetPrivate returns new DAO instance with another layer of private
// MemCachedStore around the current DAO Store.
func (dao *Simple) GetPrivate() *Simple {
d := &Simple{}
*d = *dao // Inherit everything...
d := &Simple{
Version: dao.Version,
keyBuf: dao.keyBuf,
dataBuf: dao.dataBuf,
} // Inherit everything...
d.Store = storage.NewPrivateMemCachedStore(dao.Store) // except storage, wrap another layer.
d.private = true
d.nativeCachePS = dao