- isBody := false
- comment := make([]string, 0, 4)
- lines := strings.Split(strings.TrimSuffix(string(data), "\n"), "\n")
- if len(lines) == 1 {
- return comments
- }
- for _, s := range lines {
- if s == "" {
- comments = append(comments, strings.Join(comment, "\n"))
- comment = make([]string, 0, 4)
- isBody = false
- continue
- }
- if s == "Body:" {
- isBody = true
- comment = append(comment, "")
- continue
+ r := recfile.NewReader(bytes.NewReader(data))
+ for {
+ fields, err := r.Next()
+ if err != nil {
+ break