Fix various issues with formatting and typos (#424)

* Fix typos

* Simplify code

* Fix error usage
This commit is contained in:
Michael Grosser 2016-11-13 14:03:12 +00:00 committed by Miek Gieben
parent f402b8f726
commit ece3cf8ecf
13 changed files with 19 additions and 19 deletions

View file

@ -9,7 +9,7 @@ import (
// ServiceBackend defines a (dynamic) backend that returns a slice of service definitions.
type ServiceBackend interface {
// Services communicates with the backend to retrieve the service defintion. Exact indicates
// Services communicates with the backend to retrieve the service definition. Exact indicates
// on exact much are that we are allowed to recurs.
Services(state request.Request, exact bool, opt Options) ([]msg.Service, []msg.Service, error)

View file

@ -130,7 +130,7 @@ const (
defaultCap = 10000 // default capacity of the cache.
// Success is the class for caching postive caching.
// Success is the class for caching positive caching.
Success = "success"
// Denial is the class defined for negative caching.
Denial = "denial"

View file

@ -47,7 +47,7 @@ func newItem(m *dns.Msg, d time.Duration) *item {
}
// toMsg turns i into a message, it tailers the reply to m.
// The Autoritative bit is always set to 0, because the answer is from the cache.
// The Authoritative bit is always set to 0, because the answer is from the cache.
func (i *item) toMsg(m *dns.Msg) *dns.Msg {
m1 := new(dns.Msg)
m1.SetReply(m)

View file

@ -43,7 +43,7 @@ func TestZoneSigningBlackLies(t *testing.T) {
func testNxdomainMsg() *dns.Msg {
return &dns.Msg{MsgHdr: dns.MsgHdr{Rcode: dns.RcodeNameError},
Question: []dns.Question{dns.Question{Name: "ww.miek.nl.", Qclass: dns.ClassINET, Qtype: dns.TypeTXT}},
Question: []dns.Question{{Name: "ww.miek.nl.", Qclass: dns.ClassINET, Qtype: dns.TypeTXT}},
Ns: []dns.RR{test.SOA("miek.nl. 1800 IN SOA linode.atoom.net. miek.miek.nl. 1461471181 14400 3600 604800 14400")},
}
}

View file

@ -126,7 +126,7 @@ func TransferParse(c *caddy.Controller, secondary bool) (tos, froms []string, er
for i := range tos {
if tos[i] != "*" {
if x := net.ParseIP(tos[i]); x == nil {
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", tos[i])
return nil, nil, fmt.Errorf("must specify an IP address: `%s'", tos[i])
}
tos[i] = middleware.Addr(tos[i]).Normalize()
}
@ -140,7 +140,7 @@ func TransferParse(c *caddy.Controller, secondary bool) (tos, froms []string, er
for i := range froms {
if froms[i] != "*" {
if x := net.ParseIP(froms[i]); x == nil {
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", froms[i])
return nil, nil, fmt.Errorf("must specify an IP address: `%s'", froms[i])
}
froms[i] = middleware.Addr(froms[i]).Normalize()
} else {

View file

@ -56,7 +56,7 @@ func (q *queue) pop() *Node {
return n
}
// empty returns true when the queue containes zero nodes.
// empty returns true when the queue contains zero nodes.
func (q *queue) empty() bool {
return len(*q) == 0
}

View file

@ -286,7 +286,7 @@ func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service {
}
for _, service := range svcList {
if service.Spec.ClusterIP == ip {
return []msg.Service{msg.Service{Host: ip}}
return []msg.Service{{Host: ip}}
}
}

View file

@ -14,9 +14,9 @@ const (
// Map of format string :: expected locations of name symbols in the format.
// -1 value indicates that symbol does not exist in format.
var exampleTemplates = map[string][]int{
"{service}.{namespace}.{type}.{zone}": []int{3, 1, 0}, // service symbol expected @ position 0, namespace @ 1, zone @ 3
"{namespace}.{type}.{zone}": []int{2, 0, -1},
"": []int{-1, -1, -1},
"{service}.{namespace}.{type}.{zone}": {3, 1, 0}, // service symbol expected @ position 0, namespace @ 1, zone @ 3
"{namespace}.{type}.{zone}": {2, 0, -1},
"": {-1, -1, -1},
}
func TestSetTemplate(t *testing.T) {

View file

@ -6,7 +6,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
// Request* and Reponse* are the prometheus counters and gauges we are using for exporting metrics.
// Request* and Response* are the prometheus counters and gauges we are using for exporting metrics.
var (
RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: middleware.Namespace,

View file

@ -1,4 +1,4 @@
// Package edns provides function usefull for adding/inspecting OPT records to/in messages.
// Package edns provides function useful for adding/inspecting OPT records to/in messages.
package edns
import (

View file

@ -6,7 +6,7 @@ import (
"github.com/miekg/dns"
)
// ToString convert the rcode to the offical DNS string, or to "RCODE"+value if the RCODE
// ToString convert the rcode to the official DNS string, or to "RCODE"+value if the RCODE
// value is unknown.
func ToString(rcode int) string {
if str, ok := dns.RcodeToString[rcode]; ok {

View file

@ -24,7 +24,7 @@ type dir http.Dir
// Dexample.org/...
// Db.example.org/...
//
// CoreDir will default to "$HOME/.coredns" on Unix, but it's location can be overriden with the COREDNSPATH
// CoreDir will default to "$HOME/.coredns" on Unix, but it's location can be overridden with the COREDNSPATH
// environment variable.
var CoreDir = dir(fsPath())

View file

@ -35,7 +35,7 @@ func TestAuto(t *testing.T) {
udp, _ := CoreDNSServerPorts(i, 0)
if udp == "" {
t.Fatalf("Could not get UDP listening port")
t.Fatal("Could not get UDP listening port")
}
defer i.Stop()
@ -102,7 +102,7 @@ func TestAutoNonExistentZone(t *testing.T) {
udp, _ := CoreDNSServerPorts(i, 0)
if udp == "" {
t.Fatalf("Could not get UDP listening port")
t.Fatal("Could not get UDP listening port")
}
defer i.Stop()
@ -141,7 +141,7 @@ func TestAutoAXFR(t *testing.T) {
udp, _ := CoreDNSServerPorts(i, 0)
if udp == "" {
t.Fatalf("Could not get UDP listening port")
t.Fatal("Could not get UDP listening port")
}
defer i.Stop()
@ -162,7 +162,7 @@ func TestAutoAXFR(t *testing.T) {
t.Fatal("Expected to receive reply, but didn't")
}
if len(resp.Answer) != 5 {
t.Fatal("Expected response with %d RRs, got %d", 5, len(resp.Answer))
t.Fatalf("Expected response with %d RRs, got %d", 5, len(resp.Answer))
}
}