Merge pull request #267 from sekimura/govet

tidyup a little with the latest golang.org/x/tools/cmd/vet
This commit is contained in:
Miek Gieben 2015-10-07 20:36:46 +01:00
commit ead33b75f6
4 changed files with 9 additions and 11 deletions

View File

@ -161,8 +161,8 @@ func TestClientEDNS0Local(t *testing.T) {
} }
} }
// ExampleUpdateLeaseTSIG shows how to update a lease signed with TSIG. // ExampleTsigSecret_updateLeaseTSIG shows how to update a lease signed with TSIG
func ExampleUpdateLeaseTSIG(t *testing.T) { func ExampleTsigSecret_updateLeaseTSIG() {
m := new(Msg) m := new(Msg)
m.SetUpdate("t.local.ip6.io.") m.SetUpdate("t.local.ip6.io.")
rr, _ := NewRR("t.local.ip6.io. 30 A 127.0.0.1") rr, _ := NewRR("t.local.ip6.io. 30 A 127.0.0.1")
@ -185,7 +185,7 @@ func ExampleUpdateLeaseTSIG(t *testing.T) {
_, _, err := c.Exchange(m, "127.0.0.1:53") _, _, err := c.Exchange(m, "127.0.0.1:53")
if err != nil { if err != nil {
t.Error(err) panic(err)
} }
} }

View File

@ -3,9 +3,10 @@ package dns_test
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/miekg/dns"
"log" "log"
"net" "net"
"github.com/miekg/dns"
) )
// Retrieve the MX records for miek.nl. // Retrieve the MX records for miek.nl.
@ -31,13 +32,11 @@ func ExampleMX() {
// Retrieve the DNSKEY records of a zone and convert them // Retrieve the DNSKEY records of a zone and convert them
// to DS records for SHA1, SHA256 and SHA384. // to DS records for SHA1, SHA256 and SHA384.
func ExampleDS(zone string) { func ExampleDS() {
config, _ := dns.ClientConfigFromFile("/etc/resolv.conf") config, _ := dns.ClientConfigFromFile("/etc/resolv.conf")
c := new(dns.Client) c := new(dns.Client)
m := new(dns.Msg) m := new(dns.Msg)
if zone == "" { zone := "miek.nl"
zone = "miek.nl"
}
m.SetQuestion(dns.Fqdn(zone), dns.TypeDNSKEY) m.SetQuestion(dns.Fqdn(zone), dns.TypeDNSKEY)
m.SetEdns0(4096, true) m.SetEdns0(4096, true)
r, _, err := c.Exchange(m, config.Servers[0]+":"+config.Port) r, _, err := c.Exchange(m, config.Servers[0]+":"+config.Port)

View File

@ -199,7 +199,6 @@ func needFromPunycode(s string) bool {
return true return true
} }
} }
panic("dns: not reached")
} }
// encode transforms Unicode input bytes (that represent DNS label) into // encode transforms Unicode input bytes (that represent DNS label) into

View File

@ -569,7 +569,7 @@ test IN CNAME test.a.example.com.
t.Logf("%d RRs parsed in %.2f s (%.2f RR/s)", i, float32(delta)/1e9, float32(i)/(float32(delta)/1e9)) t.Logf("%d RRs parsed in %.2f s (%.2f RR/s)", i, float32(delta)/1e9, float32(i)/(float32(delta)/1e9))
} }
func ExampleZone() { func ExampleParseZone() {
zone := `$ORIGIN . zone := `$ORIGIN .
$TTL 3600 ; 1 hour $TTL 3600 ; 1 hour
name IN SOA a6.nstld.com. hostmaster.nic.name. ( name IN SOA a6.nstld.com. hostmaster.nic.name. (
@ -799,7 +799,7 @@ func TestLowercaseTokens(t *testing.T) {
} }
} }
func ExampleGenerate() { func ExampleParseZone_generate() {
// From the manual: http://www.bind9.net/manual/bind/9.3.2/Bv9ARM.ch06.html#id2566761 // From the manual: http://www.bind9.net/manual/bind/9.3.2/Bv9ARM.ch06.html#id2566761
zone := "$GENERATE 1-2 0 NS SERVER$.EXAMPLE.\n$GENERATE 1-8 $ CNAME $.0" zone := "$GENERATE 1-2 0 NS SERVER$.EXAMPLE.\n$GENERATE 1-8 $ CNAME $.0"
to := ParseZone(strings.NewReader(zone), "0.0.192.IN-ADDR.ARPA.", "") to := ParseZone(strings.NewReader(zone), "0.0.192.IN-ADDR.ARPA.", "")