From 45e66bfe1d65cec140c1855e7373539e8bdd1889 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 21 Sep 2014 19:09:13 +0100 Subject: [PATCH] Rename ParseTextSlice to Parse. Shorter. --- example_test.go | 2 +- privaterr.go | 6 +++--- privaterr_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example_test.go b/example_test.go index 28315e27..216b8b39 100644 --- a/example_test.go +++ b/example_test.go @@ -65,7 +65,7 @@ type APAIR struct { func NewAPAIR() dns.PrivateRdata { return new(APAIR) } func (rd *APAIR) String() string { return rd.addr[0].String() + " " + rd.addr[1].String() } -func (rd *APAIR) ParseTextSlice(txt []string) error { +func (rd *APAIR) Parse(txt []string) error { if len(txt) != 2 { return errors.New("two addresses required for APAIR") } diff --git a/privaterr.go b/privaterr.go index 85e70582..3abb5369 100644 --- a/privaterr.go +++ b/privaterr.go @@ -18,8 +18,8 @@ import ( type PrivateRdata interface { // String returns the text presentaton of the Rdata of the Private RR. String() string - // ParseTextSlice parses the Rdata of the private RR. - ParseTextSlice([]string) error + // Parse parses the Rdata of the private RR. + Parse([]string) error // Pack is used when packing a private RR into a buffer. Pack([]byte) (int, error) // Unpack is used when unpacking a private RR from a buffer. @@ -98,7 +98,7 @@ func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata) } } - err := rr.Data.ParseTextSlice(text) + err := rr.Data.Parse(text) if err != nil { return nil, &ParseError{f, err.Error(), l}, "" } diff --git a/privaterr_test.go b/privaterr_test.go index 82521571..83cd8465 100644 --- a/privaterr_test.go +++ b/privaterr_test.go @@ -18,7 +18,7 @@ func NewISBN() dns.PrivateRdata { return &ISBN{""} } func (rd *ISBN) Len() int { return len([]byte(rd.x)) } func (rd *ISBN) String() string { return rd.x } -func (rd *ISBN) ParseTextSlice(txt []string) error { +func (rd *ISBN) Parse(txt []string) error { rd.x = strings.TrimSpace(strings.Join(txt, " ")) return nil } @@ -108,7 +108,7 @@ type VERSION struct { func NewVersion() dns.PrivateRdata { return &VERSION{""} } func (rd *VERSION) String() string { return rd.x } -func (rd *VERSION) ParseTextSlice(txt []string) error { +func (rd *VERSION) Parse(txt []string) error { rd.x = strings.TrimSpace(strings.Join(txt, " ")) return nil }