@@ -12,41 +12,33 @@ import (
12
12
"golang.org/x/net/dns/dnsmessage"
13
13
)
14
14
15
- func mustNewName (name string ) dnsmessage.Name {
16
- n , err := dnsmessage .NewName (name )
17
- if err != nil {
18
- panic (err )
19
- }
20
- return n
21
- }
22
-
23
15
func ExampleParser () {
24
16
msg := dnsmessage.Message {
25
17
Header : dnsmessage.Header {Response : true , Authoritative : true },
26
18
Questions : []dnsmessage.Question {
27
19
{
28
- Name : mustNewName ("foo.bar.example.com." ),
20
+ Name : dnsmessage . MustNewName ("foo.bar.example.com." ),
29
21
Type : dnsmessage .TypeA ,
30
22
Class : dnsmessage .ClassINET ,
31
23
},
32
24
{
33
- Name : mustNewName ("bar.example.com." ),
25
+ Name : dnsmessage . MustNewName ("bar.example.com." ),
34
26
Type : dnsmessage .TypeA ,
35
27
Class : dnsmessage .ClassINET ,
36
28
},
37
29
},
38
30
Answers : []dnsmessage.Resource {
39
31
{
40
32
Header : dnsmessage.ResourceHeader {
41
- Name : mustNewName ("foo.bar.example.com." ),
33
+ Name : dnsmessage . MustNewName ("foo.bar.example.com." ),
42
34
Type : dnsmessage .TypeA ,
43
35
Class : dnsmessage .ClassINET ,
44
36
},
45
37
Body : & dnsmessage.AResource {A : [4 ]byte {127 , 0 , 0 , 1 }},
46
38
},
47
39
{
48
40
Header : dnsmessage.ResourceHeader {
49
- Name : mustNewName ("bar.example.com." ),
41
+ Name : dnsmessage . MustNewName ("bar.example.com." ),
50
42
Type : dnsmessage .TypeA ,
51
43
Class : dnsmessage .ClassINET ,
52
44
},
0 commit comments