From e5a87d1ab1c5089b07144065060a8e72f8662bc7 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 11 May 2015 02:31:34 +0100 Subject: [PATCH] cosmetic: resolve some linter complaints --- nameserver/addrs.go | 22 +++++++++++----------- nameserver/mdns_client.go | 18 +++++++++--------- nameserver/mocks_test.go | 4 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/nameserver/addrs.go b/nameserver/addrs.go index b3ddfd2b..0bdb0dca 100644 --- a/nameserver/addrs.go +++ b/nameserver/addrs.go @@ -51,22 +51,22 @@ func (r Record) Priority() int { return r.priority } func (r Record) Weight() int { return r.weight } func (r Record) TTL() int { return r.ttl } -func (i Record) String() string { +func (r Record) String() string { var buf bytes.Buffer - if len(i.Name()) > 0 { - fmt.Fprintf(&buf, "%s", i.Name()) + if len(r.Name()) > 0 { + fmt.Fprintf(&buf, "%s", r.Name()) } - if !i.IP().IsUnspecified() { - fmt.Fprintf(&buf, "[%s]", i.IP()) + if !r.IP().IsUnspecified() { + fmt.Fprintf(&buf, "[%s]", r.IP()) } - if i.Priority() > 0 { - fmt.Fprintf(&buf, "/P:%d", i.Priority()) + if r.Priority() > 0 { + fmt.Fprintf(&buf, "/P:%d", r.Priority()) } - if i.Weight() > 0 { - fmt.Fprintf(&buf, "/W:%d", i.Weight()) + if r.Weight() > 0 { + fmt.Fprintf(&buf, "/W:%d", r.Weight()) } - if i.TTL() > 0 { - fmt.Fprintf(&buf, "/TTL:%d", i.TTL()) + if r.TTL() > 0 { + fmt.Fprintf(&buf, "/TTL:%d", r.TTL()) } return buf.String() diff --git a/nameserver/mdns_client.go b/nameserver/mdns_client.go index e6c91025..df814426 100644 --- a/nameserver/mdns_client.go +++ b/nameserver/mdns_client.go @@ -54,19 +54,19 @@ func (r Response) Equal(r2 *Response) bool { return true } -func (i Response) String() string { +func (r Response) String() string { var buf bytes.Buffer - if i.err != nil { - fmt.Fprintf(&buf, "%s", i.err) + if r.err != nil { + fmt.Fprintf(&buf, "%s", r.err) } else { - if len(i.Name()) > 0 { - fmt.Fprintf(&buf, "%s", i.Name()) + if len(r.Name()) > 0 { + fmt.Fprintf(&buf, "%s", r.Name()) } - if !i.IP().IsUnspecified() { - fmt.Fprintf(&buf, "[%s]", i.IP()) + if !r.IP().IsUnspecified() { + fmt.Fprintf(&buf, "[%s]", r.IP()) } - if i.ttl > 0 { - fmt.Fprintf(&buf, "(TTL:%d)", i.TTL()) + if r.ttl > 0 { + fmt.Fprintf(&buf, "(TTL:%d)", r.TTL()) } } return buf.String() diff --git a/nameserver/mocks_test.go b/nameserver/mocks_test.go index 89c05884..a566ac8f 100644 --- a/nameserver/mocks_test.go +++ b/nameserver/mocks_test.go @@ -34,7 +34,7 @@ func (mz *mockedZoneWithRecords) LookupName(name string) ([]ZoneRecord, error) { mz.Lock() defer mz.Unlock() - mz.NumLookupsName += 1 + mz.NumLookupsName++ res := make([]ZoneRecord, 0) for _, r := range mz.records { if r.Name() == name { @@ -49,7 +49,7 @@ func (mz *mockedZoneWithRecords) LookupInaddr(inaddr string) ([]ZoneRecord, erro mz.Lock() defer mz.Unlock() - mz.NumLookupsInaddr += 1 + mz.NumLookupsInaddr++ res := make([]ZoneRecord, 0) for _, r := range mz.records { revIP, err := raddrToIP(inaddr)