cosmetic: resolve some linter complaints

This commit is contained in:
Matthias Radestock committed 2015-05-11 02:31:34 +01:00
1 parent ef2c55141b
commit e5a87d1ab1
3 files changed
+22 -22

No files matched your search

+11 -11
View File
@@ -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()
+9 -9
View File
@@ -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()
+2 -2
View File
@@ -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)