fix vet warnings, update invocation

This commit is contained in:
Michael Stapelberg 2019-10-22 08:55:57 +02:00
parent 90c5f0ae62
commit 161ea97d3d
2 changed files with 16 additions and 8 deletions

View file

@ -16,7 +16,7 @@ script:
- "gofmt -l $(find . -name '*.go' | tr '\\n' ' ') >/dev/null"
# 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)"
- go tool vet .
- go vet .
- go test -c
- 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'

View file

@ -111,6 +111,14 @@ type server struct {
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) {
var eg errgroup.Group
@ -121,13 +129,13 @@ func (s *server) metrics(w http.ResponseWriter, r *http.Request) {
RecursionDesired: true,
},
Question: []dns.Question{
dns.Question{"cachesize.bind.", dns.TypeTXT, dns.ClassCHAOS},
dns.Question{"insertions.bind.", dns.TypeTXT, dns.ClassCHAOS},
dns.Question{"evictions.bind.", dns.TypeTXT, dns.ClassCHAOS},
dns.Question{"misses.bind.", dns.TypeTXT, dns.ClassCHAOS},
dns.Question{"hits.bind.", dns.TypeTXT, dns.ClassCHAOS},
dns.Question{"auth.bind.", dns.TypeTXT, dns.ClassCHAOS},
dns.Question{"servers.bind.", dns.TypeTXT, dns.ClassCHAOS},
question("cachesize.bind."),
question("insertions.bind."),
question("evictions.bind."),
question("misses.bind."),
question("hits.bind."),
question("auth.bind."),
question("servers.bind."),
},
}
in, _, err := s.dnsClient.Exchange(msg, s.dnsmasqAddr)