From 23277a9159a0e5ebbe3295feafcc1058c18dc8a7 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 1 Jan 2019 15:13:18 +0100 Subject: [PATCH] Fix broken switch statement --- parser/parser.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index ad78f97..53a83fb 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -70,13 +70,7 @@ func NewSortConfig() qEntrySortConfig { func isQEntryAttribute(attributeName string) bool { var isValidAttribute bool switch attributeName { - case "Id": - case "Status": - case "Date": - case "Size": - case "Sender": - case "Recipients": - case "Reason": + case "Id", "Status", "Date", "Size", "Sender", "Recipients", "Reason": isValidAttribute = true default: isValidAttribute = false @@ -88,9 +82,9 @@ func (c qEntrySortConfig) By(attributeName string, order string) qEntrySortConfi if !isQEntryAttribute(attributeName) { panic(fmt.Sprintf("Invalid sort attribute: '%s' given!", attributeName)) } - if order != "ASC" && order != "DESC" { - panic(fmt.Sprintf("Invalid sort order '%s' given!", order)) - } + if order != "ASC" && order != "DESC" { + panic(fmt.Sprintf("Invalid sort order '%s' given!", order)) + } newAttributeConfig := qEntryAttributeSortConfig{attribute: attributeName, order: order} c.attributes = append(c.attributes, newAttributeConfig) return c