all: rename deep "Copy" methods to conventional Go name "Clone"

This commit is contained in:
Brad Fitzpatrick
2020-02-27 12:20:29 -08:00
parent 14559340ee
commit 25797c8c2a
7 changed files with 42 additions and 27 deletions
+4 -4
View File
@@ -47,7 +47,7 @@ func (h *Handle) Start(opts Options) error {
h.engineStatusCache = EngineStatus{}
h.stateCache = NoState
if opts.Prefs != nil {
h.prefsCache = opts.Prefs.Copy()
h.prefsCache = opts.Prefs.Clone()
}
xopts := opts
xopts.Notify = h.notify
@@ -69,7 +69,7 @@ func (h *Handle) notify(n Notify) {
h.stateCache = *n.State
}
if n.Prefs != nil {
h.prefsCache = n.Prefs.Copy()
h.prefsCache = n.Prefs.Clone()
}
if n.NetMap != nil {
h.netmapCache = n.NetMap
@@ -89,14 +89,14 @@ func (h *Handle) Prefs() *Prefs {
h.mu.Lock()
defer h.mu.Unlock()
return h.prefsCache.Copy()
return h.prefsCache.Clone()
}
func (h *Handle) UpdatePrefs(updateFn func(p *Prefs)) {
h.mu.Lock()
defer h.mu.Unlock()
new := h.prefsCache.Copy()
new := h.prefsCache.Clone()
updateFn(new)
h.prefsCache = new
h.b.SetPrefs(new)