diff --git a/client_test.go b/client_test.go index 4ddd37f7..eb980576 100644 --- a/client_test.go +++ b/client_test.go @@ -161,8 +161,8 @@ func TestClientEDNS0Local(t *testing.T) { } } -// ExampleUpdateLeaseTSIG shows how to update a lease signed with TSIG. -func ExampleUpdateLeaseTSIG(t *testing.T) { +// ExampleTsigSecret_updateLeaseTSIG shows how to update a lease signed with TSIG +func ExampleTsigSecret_updateLeaseTSIG() { m := new(Msg) m.SetUpdate("t.local.ip6.io.") 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") if err != nil { - t.Error(err) + panic(err) } } diff --git a/example_test.go b/example_test.go index 1578a4d0..64c14962 100644 --- a/example_test.go +++ b/example_test.go @@ -3,9 +3,10 @@ package dns_test import ( "errors" "fmt" - "github.com/miekg/dns" "log" "net" + + "github.com/miekg/dns" ) // Retrieve the MX records for miek.nl. @@ -31,13 +32,11 @@ func ExampleMX() { // Retrieve the DNSKEY records of a zone and convert them // to DS records for SHA1, SHA256 and SHA384. -func ExampleDS(zone string) { +func ExampleDS() { config, _ := dns.ClientConfigFromFile("/etc/resolv.conf") c := new(dns.Client) m := new(dns.Msg) - if zone == "" { - zone = "miek.nl" - } + zone := "miek.nl" m.SetQuestion(dns.Fqdn(zone), dns.TypeDNSKEY) m.SetEdns0(4096, true) r, _, err := c.Exchange(m, config.Servers[0]+":"+config.Port) diff --git a/idn/punycode.go b/idn/punycode.go index d3433fbd..7e5c263f 100644 --- a/idn/punycode.go +++ b/idn/punycode.go @@ -199,7 +199,6 @@ func needFromPunycode(s string) bool { return true } } - panic("dns: not reached") } // encode transforms Unicode input bytes (that represent DNS label) into diff --git a/parse_test.go b/parse_test.go index 1bf4d871..f2922e0b 100644 --- a/parse_test.go +++ b/parse_test.go @@ -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)) } -func ExampleZone() { +func ExampleParseZone() { zone := `$ORIGIN . $TTL 3600 ; 1 hour 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 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.", "")