Extend structs rather than embed, when possible

This commit is contained in:
Jason A. Donenfeld
2019-01-03 19:04:00 +01:00
parent dff424baf8
commit 89d2c5ed7a
16 changed files with 213 additions and 215 deletions

View File

@@ -31,15 +31,15 @@ type Keypair struct {
}
type Keypairs struct {
mutex sync.RWMutex
sync.RWMutex
current *Keypair
previous *Keypair
next *Keypair
}
func (kp *Keypairs) Current() *Keypair {
kp.mutex.RLock()
defer kp.mutex.RUnlock()
kp.RLock()
defer kp.RUnlock()
return kp.current
}