func SplitParams(params string) []string {
	paramsOpen := false
	result := strings.FieldsFunc(params, func(r rune) bool {
		if r == '[' {
			paramsOpen = true
		}
		if r == ']' {
			paramsOpen = false
		}
		if r == ' ' && !paramsOpen {
			return true
		}
		return false
	})
	return result
}
SplitParams splits parameters in IMAP arguments so that they're easily
readable.
package util
import (
	"bytes"
	"fmt"
	"io"
	"net/textproto"
	"strings"
	"time"
)
const RFC822Date = "Mon, 2 Jan 2006 15:04:05 +0700"
const InternalDate = "02-Jan-2006 15:04:05 +0700"
func FormatDate(date time.Time) string {
	return date.Format(RFC822Date)
}