aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Carl-Magnus Björkell <cmb@tradeshift.com> 2019-01-27 18:54:28 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2019-01-27 17:54:28 +0000
commit48a8d6c75e667598fefda4a458b125df03862970 (patch)
tree552600b837f273bfd9cc3d342a70ec9adf8680a9 /plugin
parent74c8bf25dccf6d2cf062a3599f04478bbdb0d0bb (diff)
downloadcoredns-48a8d6c75e667598fefda4a458b125df03862970.tar.gz
coredns-48a8d6c75e667598fefda4a458b125df03862970.tar.zst
coredns-48a8d6c75e667598fefda4a458b125df03862970.zip
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.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/etcd/etcd.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugin/etcd/etcd.go b/plugin/etcd/etcd.go
index 4734fe344..17422e347 100644
--- a/plugin/etcd/etcd.go
+++ b/plugin/etcd/etcd.go
@@ -139,13 +139,12 @@ Nodes:
if err := json.Unmarshal(n.Value, serv); err != nil {
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)}
- if _, ok := bx[b]; ok {
+ serv.Key = string(n.Key)
+ if _, ok := bx[*serv]; ok {
continue
}
- bx[b] = struct{}{}
+ bx[*serv] = struct{}{}
- serv.Key = string(n.Key)
serv.TTL = e.TTL(n, serv)
if serv.Priority == 0 {
serv.Priority = priority