From 063fb5756d27a1f6064bf5811aba4835e4d24ba1 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sat, 29 Dec 2018 18:16:54 +0100 Subject: [PATCH] Rename Entry to QEntry in parser.go --- parser/parser.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index 7b8220c..391edf2 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -10,7 +10,7 @@ import ( "time" ) -type Entry struct { +type QEntry struct { id string status string date time.Time @@ -20,11 +20,11 @@ type Entry struct { reason string } -func (m Entry) String() string { +func (m QEntry) String() string { return fmt.Sprintf("ID: %s, Status: %s, Size: %d bytes, Sender: %s, Recipients: %d", m.id, m.status, m.size, m.sender, len(m.recipients)) } -func ParseMailQ(scanner *bufio.Scanner) ([]Entry, error) { +func ParseMailQ(scanner *bufio.Scanner) ([]QEntry, error) { const dateFormat = "2006 Mon Jan _2 15:04:05" var messageIdStart = regexp.MustCompile("^[0-9A-Za-z]+[*!]? ") scanner.Scan() @@ -36,8 +36,8 @@ func ParseMailQ(scanner *bufio.Scanner) ([]Entry, error) { // Abort if input does not look like output from mailq(1) return nil, errors.New("Sorry, this does not look like output from mailq(1).") } - var currentMail Entry - var queueEntries []Entry + var currentMail QEntry + var queueEntries []QEntry for scanner.Scan() { // Read input line by line @@ -75,7 +75,7 @@ func ParseMailQ(scanner *bufio.Scanner) ([]Entry, error) { // If the next line is empty, make sure to push current mail to list // and create a new struct for the next mail to process queueEntries = append(queueEntries, currentMail) - currentMail = Entry{} + currentMail = QEntry{} } } if scanner.Err() != nil {