mirror of
https://github.com/coredns/coredns.git
synced 2025-11-06 03:56:24 -05:00
plugin/etcd: Remove unnecessary struct copy (#2497)
The `b` struct is just copying all the fields into a new one, to check if it already existed in a set. This isn't needed as all the fields are identical, and a small rearrangement of the code solves the same problem without the copy.
This commit is contained in:
committed by
Miek Gieben
parent
74c8bf25dc
commit
48a8d6c75e
@@ -139,13 +139,12 @@ Nodes:
|
|||||||
if err := json.Unmarshal(n.Value, serv); err != nil {
|
if err := json.Unmarshal(n.Value, serv); err != nil {
|
||||||
return nil, fmt.Errorf("%s: %s", n.Key, err.Error())
|
return nil, fmt.Errorf("%s: %s", n.Key, err.Error())
|
||||||
}
|
}
|
||||||
b := msg.Service{Host: serv.Host, Port: serv.Port, Priority: serv.Priority, Weight: serv.Weight, Text: serv.Text, Key: string(n.Key)}
|
serv.Key = string(n.Key)
|
||||||
if _, ok := bx[b]; ok {
|
if _, ok := bx[*serv]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bx[b] = struct{}{}
|
bx[*serv] = struct{}{}
|
||||||
|
|
||||||
serv.Key = string(n.Key)
|
|
||||||
serv.TTL = e.TTL(n, serv)
|
serv.TTL = e.TTL(n, serv)
|
||||||
if serv.Priority == 0 {
|
if serv.Priority == 0 {
|
||||||
serv.Priority = priority
|
serv.Priority = priority
|
||||||
|
|||||||
Reference in New Issue
Block a user