From e49ca86ce463395f7d0d2b997c93d25e3d101ca0 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 14 Jun 2017 09:37:10 -0700 Subject: [PATCH] cleanup: go vet and golint run (#736) * cleanup: go vet and golint run Various cleanups trickered by go vet and golint. * Fix tests and lowercase all errors Lowercase all errors, some tests in kubernetes use errors from kubernetes which do start with a capital letter. --- core/dnsserver/server-grpc.go | 24 +++++++++++----------- middleware/cache/freq/freq.go | 3 ++- middleware/debug/debug_test.go | 2 +- middleware/file/notify.go | 4 ++-- middleware/file/reload.go | 2 +- middleware/kubernetes/federation.go | 9 ++++---- middleware/kubernetes/federation_test.go | 4 ++-- middleware/kubernetes/kubernetes.go | 4 ++-- middleware/kubernetes/kubernetes_test.go | 4 ++-- middleware/kubernetes/setup.go | 14 ++++++------- middleware/kubernetes/setup_test.go | 26 ++++++++++++------------ middleware/pkg/response/typify.go | 2 +- middleware/pkg/tls/tls.go | 8 ++++---- middleware/proxy/dns.go | 1 + middleware/proxy/lookup.go | 2 +- middleware/rewrite/condition.go | 2 +- middleware/rewrite/edns0.go | 2 +- middleware/rewrite/rewrite.go | 2 +- middleware/trace/trace.go | 5 +++-- test/grpc_test.go | 4 ++-- test/reload_test.go | 2 +- 21 files changed, 64 insertions(+), 62 deletions(-) diff --git a/core/dnsserver/server-grpc.go b/core/dnsserver/server-grpc.go index 41fee8c8a..36de69ed8 100644 --- a/core/dnsserver/server-grpc.go +++ b/core/dnsserver/server-grpc.go @@ -16,8 +16,8 @@ import ( "github.com/coredns/coredns/pb" ) -// servergRPC represents an instance of a DNS-over-gRPC server. -type servergRPC struct { +// ServergRPC represents an instance of a DNS-over-gRPC server. +type ServergRPC struct { *Server grpcServer *grpc.Server @@ -25,18 +25,18 @@ type servergRPC struct { } // NewServergRPC returns a new CoreDNS GRPC server and compiles all middleware in to it. -func NewServergRPC(addr string, group []*Config) (*servergRPC, error) { +func NewServergRPC(addr string, group []*Config) (*ServergRPC, error) { s, err := NewServer(addr, group) if err != nil { return nil, err } - gs := &servergRPC{Server: s} + gs := &ServergRPC{Server: s} return gs, nil } // Serve implements caddy.TCPServer interface. -func (s *servergRPC) Serve(l net.Listener) error { +func (s *ServergRPC) Serve(l net.Listener) error { s.m.Lock() s.listenAddr = l.Addr() s.m.Unlock() @@ -57,10 +57,10 @@ func (s *servergRPC) Serve(l net.Listener) error { } // ServePacket implements caddy.UDPServer interface. -func (s *servergRPC) ServePacket(p net.PacketConn) error { return nil } +func (s *ServergRPC) ServePacket(p net.PacketConn) error { return nil } // Listen implements caddy.TCPServer interface. -func (s *servergRPC) Listen() (net.Listener, error) { +func (s *ServergRPC) Listen() (net.Listener, error) { // The *tls* middleware must make sure that multiple conflicting // TLS configuration return an error: it can only be specified once. @@ -88,11 +88,11 @@ func (s *servergRPC) Listen() (net.Listener, error) { } // ListenPacket implements caddy.UDPServer interface. -func (s *servergRPC) ListenPacket() (net.PacketConn, error) { return nil, nil } +func (s *ServergRPC) ListenPacket() (net.PacketConn, error) { return nil, nil } // OnStartupComplete lists the sites served by this server // and any relevant information, assuming Quiet is false. -func (s *servergRPC) OnStartupComplete() { +func (s *ServergRPC) OnStartupComplete() { if Quiet { return } @@ -102,7 +102,7 @@ func (s *servergRPC) OnStartupComplete() { } } -func (s *servergRPC) Stop() (err error) { +func (s *ServergRPC) Stop() (err error) { s.m.Lock() defer s.m.Unlock() if s.grpcServer != nil { @@ -114,7 +114,7 @@ func (s *servergRPC) Stop() (err error) { // Query is the main entry-point into the gRPC server. From here we call ServeDNS like // any normal server. We use a custom responseWriter to pick up the bytes we need to write // back to the client as a protobuf. -func (s *servergRPC) Query(ctx context.Context, in *pb.DnsPacket) (*pb.DnsPacket, error) { +func (s *ServergRPC) Query(ctx context.Context, in *pb.DnsPacket) (*pb.DnsPacket, error) { msg := new(dns.Msg) err := msg.Unpack(in.Msg) if err != nil { @@ -144,7 +144,7 @@ func (s *servergRPC) Query(ctx context.Context, in *pb.DnsPacket) (*pb.DnsPacket return &pb.DnsPacket{Msg: packed}, nil } -func (s *servergRPC) Shutdown() error { +func (s *ServergRPC) Shutdown() error { if s.grpcServer != nil { s.grpcServer.Stop() } diff --git a/middleware/cache/freq/freq.go b/middleware/cache/freq/freq.go index 528eedc1c..4e7f7722e 100644 --- a/middleware/cache/freq/freq.go +++ b/middleware/cache/freq/freq.go @@ -7,6 +7,7 @@ import ( "time" ) +// Freq tracks the frequence of things. type Freq struct { // Last time we saw a query for this element. last time.Time @@ -21,7 +22,7 @@ func New(t time.Time) *Freq { return &Freq{last: t, hits: 0} } -// Updates updates the number of hits. Last time seen will be set to now. +// Update updates the number of hits. Last time seen will be set to now. // If the last time we've seen this entity is within now - d, we increment hits, otherwise // we reset hits to 1. It returns the number of hits. func (f *Freq) Update(d time.Duration, now time.Time) int { diff --git a/middleware/debug/debug_test.go b/middleware/debug/debug_test.go index 349b362f1..a4802fee5 100644 --- a/middleware/debug/debug_test.go +++ b/middleware/debug/debug_test.go @@ -43,7 +43,7 @@ func TestDebug(t *testing.T) { } } if cfg.Debug != test.expectedDebug { - t.Fatalf("Test %d: Expected debug to be: %t, but got: %t, input: %s", i, test.expectedDebug, test.input) + t.Fatalf("Test %d: Expected debug to be: %t, but got: %t, input: %s", i, test.expectedDebug, cfg.Debug, test.input) } } } diff --git a/middleware/file/notify.go b/middleware/file/notify.go index 381c1e8c2..90dfdc521 100644 --- a/middleware/file/notify.go +++ b/middleware/file/notify.go @@ -71,7 +71,7 @@ func notifyAddr(c *dns.Client, m *dns.Msg, s string) (err error) { } } if err != nil { - return fmt.Errorf("Notify for zone %q was not accepted by %q: %q", m.Question[0].Name, s, err) + return fmt.Errorf("notify for zone %q was not accepted by %q: %q", m.Question[0].Name, s, err) } - return fmt.Errorf("Notify for zone %q was not accepted by %q: rcode was %q", m.Question[0].Name, s, rcode.ToString(code)) + return fmt.Errorf("notify for zone %q was not accepted by %q: rcode was %q", m.Question[0].Name, s, rcode.ToString(code)) } diff --git a/middleware/file/reload.go b/middleware/file/reload.go index bd3bbbd08..18e949a94 100644 --- a/middleware/file/reload.go +++ b/middleware/file/reload.go @@ -60,7 +60,7 @@ func (z *Zone) Reload() error { return nil } -// SOASerialIfDefind returns the SOA's serial if the zone has a SOA record in the Apex, or +// SOASerialIfDefined returns the SOA's serial if the zone has a SOA record in the Apex, or // -1 otherwise. func (z *Zone) SOASerialIfDefined() int64 { z.reloadMu.Lock() diff --git a/middleware/kubernetes/federation.go b/middleware/kubernetes/federation.go index 9a2908ded..4c058b839 100644 --- a/middleware/kubernetes/federation.go +++ b/middleware/kubernetes/federation.go @@ -7,6 +7,7 @@ import ( "github.com/coredns/coredns/middleware/etcd/msg" ) +// Federation holds TODO(...). type Federation struct { name string zone string @@ -26,8 +27,8 @@ const ( // // But importing above breaks coredns with flag collision of 'log_dir' - LabelAvailabilityZone = "failure-domain.beta.kubernetes.io/zone" - LabelRegion = "failure-domain.beta.kubernetes.io/region" + labelAvailabilityZone = "failure-domain.beta.kubernetes.io/zone" + labelRegion = "failure-domain.beta.kubernetes.io/region" ) // stripFederation removes the federation segment from the segment list, if it @@ -66,12 +67,12 @@ func (k *Kubernetes) federationCNAMERecord(r recordRequest) msg.Service { if r.endpoint == "" { return msg.Service{ Key: strings.Join([]string{msg.Path(r.zone, "coredns"), r.typeName, r.federation, r.namespace, r.service}, "/"), - Host: strings.Join([]string{r.service, r.namespace, r.federation, r.typeName, node.Labels[LabelAvailabilityZone], node.Labels[LabelRegion], f.zone}, "."), + Host: strings.Join([]string{r.service, r.namespace, r.federation, r.typeName, node.Labels[labelAvailabilityZone], node.Labels[labelRegion], f.zone}, "."), } } return msg.Service{ Key: strings.Join([]string{msg.Path(r.zone, "coredns"), r.typeName, r.federation, r.namespace, r.service, r.endpoint}, "/"), - Host: strings.Join([]string{r.endpoint, r.service, r.namespace, r.federation, r.typeName, node.Labels[LabelAvailabilityZone], node.Labels[LabelRegion], f.zone}, "."), + Host: strings.Join([]string{r.endpoint, r.service, r.namespace, r.federation, r.typeName, node.Labels[labelAvailabilityZone], node.Labels[labelRegion], f.zone}, "."), } } diff --git a/middleware/kubernetes/federation_test.go b/middleware/kubernetes/federation_test.go index 2c33a544f..a938159ff 100644 --- a/middleware/kubernetes/federation_test.go +++ b/middleware/kubernetes/federation_test.go @@ -66,8 +66,8 @@ func (apiConnFedTest) GetNodeByName(name string) (api.Node, error) { ObjectMeta: api.ObjectMeta{ Name: "test.node.foo.bar", Labels: map[string]string{ - LabelRegion: "fd-r", - LabelAvailabilityZone: "fd-az", + labelRegion: "fd-r", + labelAvailabilityZone: "fd-az", }, }, }, nil diff --git a/middleware/kubernetes/kubernetes.go b/middleware/kubernetes/kubernetes.go index dea4a812d..abc4e603b 100644 --- a/middleware/kubernetes/kubernetes.go +++ b/middleware/kubernetes/kubernetes.go @@ -230,7 +230,7 @@ func (k *Kubernetes) InitKubeCache() (err error) { kubeClient, err := kubernetes.NewForConfig(config) if err != nil { - return fmt.Errorf("Failed to create kubernetes notification controller: %v", err) + return fmt.Errorf("failed to create kubernetes notification controller: %v", err) } if k.LabelSelector != nil { @@ -238,7 +238,7 @@ func (k *Kubernetes) InitKubeCache() (err error) { selector, err = unversionedapi.LabelSelectorAsSelector(k.LabelSelector) k.Selector = &selector if err != nil { - return fmt.Errorf("Unable to create Selector for LabelSelector '%s'.Error was: %s", k.LabelSelector, err) + return fmt.Errorf("unable to create Selector for LabelSelector '%s'.Error was: %s", k.LabelSelector, err) } } diff --git a/middleware/kubernetes/kubernetes_test.go b/middleware/kubernetes/kubernetes_test.go index 2bfff0c78..d740027f6 100644 --- a/middleware/kubernetes/kubernetes_test.go +++ b/middleware/kubernetes/kubernetes_test.go @@ -431,8 +431,8 @@ func (APIConnServiceTest) GetNodeByName(name string) (api.Node, error) { ObjectMeta: api.ObjectMeta{ Name: "test.node.foo.bar", Labels: map[string]string{ - LabelRegion: "fd-r", - LabelAvailabilityZone: "fd-az", + labelRegion: "fd-r", + labelAvailabilityZone: "fd-az", }, }, }, nil diff --git a/middleware/kubernetes/setup.go b/middleware/kubernetes/setup.go index 05eeaa02f..1f8a1f0e3 100644 --- a/middleware/kubernetes/setup.go +++ b/middleware/kubernetes/setup.go @@ -96,7 +96,7 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) { for _, cidrStr := range args { _, cidr, err := net.ParseCIDR(cidrStr) if err != nil { - return nil, errors.New("Invalid cidr: " + cidrStr) + return nil, fmt.Errorf("invalid cidr: %s", cidrStr) } k8s.ReverseCidrs = append(k8s.ReverseCidrs, *cidr) @@ -111,7 +111,7 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) { case PodModeDisabled, PodModeInsecure, PodModeVerified: k8s.PodMode = args[0] default: - return nil, errors.New("Value for pods must be one of: disabled, verified, insecure") + return nil, fmt.Errorf("wrong value for pods: %s, must be one of: disabled, verified, insecure", args[0]) } continue } @@ -142,7 +142,7 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) { if len(args) > 0 { rp, err := time.ParseDuration(args[0]) if err != nil { - return nil, fmt.Errorf("Unable to parse resync duration value. Value provided was '%v'. Example valid values: '15s', '5m', '1h'. Error was: %v", args[0], err) + return nil, fmt.Errorf("unable to parse resync duration value: '%v': %v", args[0], err) } k8s.ResyncPeriod = rp continue @@ -154,7 +154,7 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) { labelSelectorString := strings.Join(args, " ") ls, err := unversionedapi.ParseToLabelSelector(labelSelectorString) if err != nil { - return nil, fmt.Errorf("Unable to parse label selector. Value provided was '%v'. Error was: %v", labelSelectorString, err) + return nil, fmt.Errorf("unable to parse label selector value: '%v': %v", labelSelectorString, err) } k8s.LabelSelector = ls continue @@ -185,17 +185,15 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) { zone: args[1], }) continue - } else { - return nil, fmt.Errorf("Incorrect number of arguments for federation. Got %v, expect 2.", len(args)) } - return nil, c.ArgErr() + return nil, fmt.Errorf("incorrect number of arguments for federation, got %v, expected 2", len(args)) } } return k8s, nil } } - return nil, errors.New("Kubernetes setup called without keyword 'kubernetes' in Corefile") + return nil, errors.New("kubernetes setup called without keyword 'kubernetes' in Corefile") } const ( diff --git a/middleware/kubernetes/setup_test.go b/middleware/kubernetes/setup_test.go index d150daba9..8414d76fd 100644 --- a/middleware/kubernetes/setup_test.go +++ b/middleware/kubernetes/setup_test.go @@ -223,7 +223,7 @@ func TestKubernetesParse(t *testing.T) { "no kubernetes keyword", "", true, - "Kubernetes setup called without keyword 'kubernetes' in Corefile", + "kubernetes setup called without keyword 'kubernetes' in Corefile", -1, -1, defaultResyncPeriod, @@ -255,7 +255,7 @@ func TestKubernetesParse(t *testing.T) { endpoint }`, true, - "Wrong argument count or unexpected line ending after 'endpoint'", + "rong argument count or unexpected line ending", -1, -1, defaultResyncPeriod, @@ -272,7 +272,7 @@ func TestKubernetesParse(t *testing.T) { namespaces }`, true, - "Parse error: Wrong argument count or unexpected line ending after 'namespaces'", + "rong argument count or unexpected line ending", -1, -1, defaultResyncPeriod, @@ -289,7 +289,7 @@ func TestKubernetesParse(t *testing.T) { resyncperiod }`, true, - "Wrong argument count or unexpected line ending after 'resyncperiod'", + "rong argument count or unexpected line ending", -1, 0, 0 * time.Minute, @@ -306,7 +306,7 @@ func TestKubernetesParse(t *testing.T) { resyncperiod 15 }`, true, - "Unable to parse resync duration value. Value provided was ", + "unable to parse resync duration value", -1, 0, 0 * time.Second, @@ -323,7 +323,7 @@ func TestKubernetesParse(t *testing.T) { resyncperiod abc }`, true, - "Unable to parse resync duration value. Value provided was ", + "unable to parse resync duration value", -1, 0, 0 * time.Second, @@ -340,7 +340,7 @@ func TestKubernetesParse(t *testing.T) { labels }`, true, - "Wrong argument count or unexpected line ending after 'labels'", + "rong argument count or unexpected line ending", -1, 0, 0 * time.Second, @@ -357,7 +357,7 @@ func TestKubernetesParse(t *testing.T) { labels environment in (production, qa }`, true, - "Unable to parse label selector. Value provided was", + "unable to parse label selector", -1, 0, 0 * time.Second, @@ -429,7 +429,7 @@ func TestKubernetesParse(t *testing.T) { pods giant_seed }`, true, - "Value for pods must be one of: disabled, verified, insecure", + "rong value for pods", -1, 0, defaultResyncPeriod, @@ -460,12 +460,12 @@ func TestKubernetesParse(t *testing.T) { }, // cidrs ok { - "Invalid cidr: hard", + "invalid cidr: hard", `kubernetes coredns.local { cidrs hard dry }`, true, - "Invalid cidr: hard", + "invalid cidr: hard", -1, 0, defaultResyncPeriod, @@ -483,7 +483,7 @@ func TestKubernetesParse(t *testing.T) { fallthrough junk }`, true, - "Wrong argument count", + "rong argument count", -1, 0, defaultResyncPeriod, @@ -559,7 +559,7 @@ func TestKubernetesParse(t *testing.T) { federation starship }`, true, - `Incorrect number of arguments for federation. Got 1, expect 2.`, + `incorrect number of arguments for federation`, -1, 0, defaultResyncPeriod, diff --git a/middleware/pkg/response/typify.go b/middleware/pkg/response/typify.go index bbde98444..7cfaab497 100644 --- a/middleware/pkg/response/typify.go +++ b/middleware/pkg/response/typify.go @@ -108,7 +108,7 @@ func Typify(m *dns.Msg, t time.Time) (Type, *dns.OPT) { return NameError, opt } - if ns > 0 && ns > 0 && m.Rcode == dns.RcodeSuccess { + if ns > 0 && m.Rcode == dns.RcodeSuccess { return Delegation, opt } diff --git a/middleware/pkg/tls/tls.go b/middleware/pkg/tls/tls.go index 7ec30c4ff..62889f542 100644 --- a/middleware/pkg/tls/tls.go +++ b/middleware/pkg/tls/tls.go @@ -50,7 +50,7 @@ func NewTLSConfigFromArgs(args ...string) (*tls.Config, error) { // Client cert, use specified CA c, err = NewTLSConfig(args[0], args[1], args[2]) default: - err = fmt.Errorf("Maximum of three arguments allowed for TLS config, found %d", len(args)) + err = fmt.Errorf("maximum of three arguments allowed for TLS config, found %d", len(args)) } if err != nil { return nil, err @@ -64,7 +64,7 @@ func NewTLSConfigFromArgs(args ...string) (*tls.Config, error) { func NewTLSConfig(certPath, keyPath, caPath string) (*tls.Config, error) { cert, err := tls.LoadX509KeyPair(certPath, keyPath) if err != nil { - return nil, fmt.Errorf("Could not load TLS cert: %s", err) + return nil, fmt.Errorf("could not load TLS cert: %s", err) } roots, err := loadRoots(caPath) @@ -94,11 +94,11 @@ func loadRoots(caPath string) (*x509.CertPool, error) { roots := x509.NewCertPool() pem, err := ioutil.ReadFile(caPath) if err != nil { - return nil, fmt.Errorf("Error reading %s: %s", caPath, err) + return nil, fmt.Errorf("error reading %s: %s", caPath, err) } ok := roots.AppendCertsFromPEM(pem) if !ok { - return nil, fmt.Errorf("Could not read root certs: %s", err) + return nil, fmt.Errorf("could not read root certs: %s", err) } return roots, nil } diff --git a/middleware/proxy/dns.go b/middleware/proxy/dns.go index 157d97992..c1c0ad078 100644 --- a/middleware/proxy/dns.go +++ b/middleware/proxy/dns.go @@ -15,6 +15,7 @@ type dnsEx struct { Options } +// Options define the options understood by dns.Exchange. type Options struct { ForceTCP bool // If true use TCP for upstream no matter what } diff --git a/middleware/proxy/lookup.go b/middleware/proxy/lookup.go index 370307cc1..e871774cf 100644 --- a/middleware/proxy/lookup.go +++ b/middleware/proxy/lookup.go @@ -17,7 +17,7 @@ func NewLookup(hosts []string) Proxy { return NewLookupWithOption(hosts, Options{}) } -// NewLookupWithForcedProto process creates a simple round robin forward with potentially forced proto for upstream. +// NewLookupWithOption process creates a simple round robin forward with potentially forced proto for upstream. func NewLookupWithOption(hosts []string, opts Options) Proxy { p := Proxy{Next: nil} diff --git a/middleware/rewrite/condition.go b/middleware/rewrite/condition.go index 5bc8452a9..d4a54d44a 100644 --- a/middleware/rewrite/condition.go +++ b/middleware/rewrite/condition.go @@ -23,7 +23,7 @@ const ( ) func operatorError(operator string) error { - return fmt.Errorf("Invalid operator %v", operator) + return fmt.Errorf("invalid operator %v", operator) } func newReplacer(r *dns.Msg) replacer.Replacer { diff --git a/middleware/rewrite/edns0.go b/middleware/rewrite/edns0.go index 3ba214c6a..1a0685312 100644 --- a/middleware/rewrite/edns0.go +++ b/middleware/rewrite/edns0.go @@ -94,7 +94,7 @@ func (rule *edns0LocalRule) Rewrite(r *dns.Msg) Result { // newEdns0Rule creates an EDNS0 rule of the appropriate type based on the args func newEdns0Rule(args ...string) (Rule, error) { if len(args) < 2 { - return nil, fmt.Errorf("Too few arguments for an EDNS0 rule") + return nil, fmt.Errorf("too few arguments for an EDNS0 rule") } ruleType := strings.ToLower(args[0]) diff --git a/middleware/rewrite/rewrite.go b/middleware/rewrite/rewrite.go index 2db97b2f1..aa27c3a2a 100644 --- a/middleware/rewrite/rewrite.go +++ b/middleware/rewrite/rewrite.go @@ -64,7 +64,7 @@ type Rule interface { func newRule(args ...string) (Rule, error) { if len(args) == 0 { - return nil, fmt.Errorf("No rule type specified for rewrite") + return nil, fmt.Errorf("no rule type specified for rewrite") } ruleType := strings.ToLower(args[0]) diff --git a/middleware/trace/trace.go b/middleware/trace/trace.go index 78089b0e1..39b7d6750 100644 --- a/middleware/trace/trace.go +++ b/middleware/trace/trace.go @@ -7,11 +7,12 @@ import ( "sync/atomic" "github.com/coredns/coredns/middleware" + // Plugin the trace package. _ "github.com/coredns/coredns/middleware/pkg/trace" + "github.com/miekg/dns" ot "github.com/opentracing/opentracing-go" zipkin "github.com/openzipkin/zipkin-go-opentracing" - "golang.org/x/net/context" ) @@ -40,7 +41,7 @@ func (t *trace) OnStartup() error { case "zipkin": err = t.setupZipkin() default: - err = fmt.Errorf("Unknown endpoint type: %s", t.EndpointType) + err = fmt.Errorf("unknown endpoint type: %s", t.EndpointType) } }) return err diff --git a/test/grpc_test.go b/test/grpc_test.go index 4e01ea8f0..4795819fb 100644 --- a/test/grpc_test.go +++ b/test/grpc_test.go @@ -52,10 +52,10 @@ func TestGrpc(t *testing.T) { } if d.Rcode != dns.RcodeSuccess { - t.Errorf("Expected success but got %s", d.Rcode) + t.Errorf("Expected success but got %d", d.Rcode) } if len(d.Extra) != 2 { - t.Errorf("Expected 2 RRs in additional section, but got %s", len(d.Extra)) + t.Errorf("Expected 2 RRs in additional section, but got %d", len(d.Extra)) } } diff --git a/test/reload_test.go b/test/reload_test.go index 61fc76b26..0f9db5059 100644 --- a/test/reload_test.go +++ b/test/reload_test.go @@ -45,6 +45,6 @@ func send(t *testing.T, server string) { t.Fatalf("Expected successful reply, got %s", dns.RcodeToString[r.Rcode]) } if len(r.Extra) != 2 { - t.Fatalf("Expected 2 RRs in additional, got %s", len(r.Extra)) + t.Fatalf("Expected 2 RRs in additional, got %d", len(r.Extra)) } }