fix vet warnings, update invocation
This commit is contained in:
parent
90c5f0ae62
commit
161ea97d3d
|
@ -16,7 +16,7 @@ script:
|
||||||
- "gofmt -l $(find . -name '*.go' | tr '\\n' ' ') >/dev/null"
|
- "gofmt -l $(find . -name '*.go' | tr '\\n' ' ') >/dev/null"
|
||||||
# Check whether files were not gofmt'ed.
|
# Check whether files were not gofmt'ed.
|
||||||
- "gosrc=$(find . -name '*.go' | tr '\\n' ' '); [ $(gofmt -l $gosrc 2>&- | wc -l) -eq 0 ] || (echo 'gofmt was not run on these files:'; gofmt -l $gosrc 2>&-; false)"
|
- "gosrc=$(find . -name '*.go' | tr '\\n' ' '); [ $(gofmt -l $gosrc 2>&- | wc -l) -eq 0 ] || (echo 'gofmt was not run on these files:'; gofmt -l $gosrc 2>&-; false)"
|
||||||
- go tool vet .
|
- go vet .
|
||||||
- go test -c
|
- go test -c
|
||||||
- docker build --pull --no-cache --rm -t=dns -f travis/Dockerfile .
|
- docker build --pull --no-cache --rm -t=dns -f travis/Dockerfile .
|
||||||
- docker run -v $PWD:/usr/src:ro dns /bin/sh -c './dnsmasq_exporter.test -test.v'
|
- docker run -v $PWD:/usr/src:ro dns /bin/sh -c './dnsmasq_exporter.test -test.v'
|
||||||
|
|
22
dnsmasq.go
22
dnsmasq.go
|
@ -111,6 +111,14 @@ type server struct {
|
||||||
leasesPath string
|
leasesPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func question(name string) dns.Question {
|
||||||
|
return dns.Question{
|
||||||
|
Name: name,
|
||||||
|
Qtype: dns.TypeTXT,
|
||||||
|
Qclass: dns.ClassCHAOS,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *server) metrics(w http.ResponseWriter, r *http.Request) {
|
func (s *server) metrics(w http.ResponseWriter, r *http.Request) {
|
||||||
var eg errgroup.Group
|
var eg errgroup.Group
|
||||||
|
|
||||||
|
@ -121,13 +129,13 @@ func (s *server) metrics(w http.ResponseWriter, r *http.Request) {
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
},
|
},
|
||||||
Question: []dns.Question{
|
Question: []dns.Question{
|
||||||
dns.Question{"cachesize.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("cachesize.bind."),
|
||||||
dns.Question{"insertions.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("insertions.bind."),
|
||||||
dns.Question{"evictions.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("evictions.bind."),
|
||||||
dns.Question{"misses.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("misses.bind."),
|
||||||
dns.Question{"hits.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("hits.bind."),
|
||||||
dns.Question{"auth.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("auth.bind."),
|
||||||
dns.Question{"servers.bind.", dns.TypeTXT, dns.ClassCHAOS},
|
question("servers.bind."),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
in, _, err := s.dnsClient.Exchange(msg, s.dnsmasqAddr)
|
in, _, err := s.dnsClient.Exchange(msg, s.dnsmasqAddr)
|
||||||
|
|
Loading…
Reference in a new issue