From 9ca36dc77b333773c24a139d2f6e7cf9fcca15da Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sun, 20 Mar 2016 18:31:45 -0400 Subject: [PATCH] Replace Compile with MustCompile --- highlighter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/highlighter.go b/highlighter.go index 2968fca8..fd74611e 100644 --- a/highlighter.go +++ b/highlighter.go @@ -35,8 +35,8 @@ func LoadSyntaxFilesFromDir(dir string) { continue } lines := strings.Split(string(text), "\n") - syntaxParser, _ := regexp.Compile(`syntax "(.*?)"\s+"(.*)"`) - headerParser, _ := regexp.Compile(`header "(.*)"`) + syntaxParser := regexp.MustCompile(`syntax "(.*?)"\s+"(.*)"`) + headerParser := regexp.MustCompile(`header "(.*)"`) syntaxMatches := syntaxParser.FindSubmatch([]byte(lines[0])) var headerRegex *regexp.Regexp @@ -84,7 +84,7 @@ func Match(rules string, buf *Buffer) map[int]tcell.Style { lines := strings.Split(rules, "\n") m := make(map[int]tcell.Style) - parser, _ := regexp.Compile(`color (.*?)\s+"(.*)"`) + parser := regexp.MustCompile(`color (.*?)\s+"(.*)"`) for _, line := range lines { if strings.TrimSpace(line) == "" || strings.TrimSpace(line)[0] == '#' ||