Monorepo for Tangled

knotserver/git/merge: pre-compile conflict error regex at package init

Signed-off-by: Matías Insaurralde <matias@insaurral.de>

authored by matias.tngl.sh and committed by tangled.org 2677d2b1 5a17af77

+3 -2
+3 -2
knotserver/git/merge.go
··· 22 22 } 23 23 24 24 var ( 25 - mergeCheckCache MergeCheckCache 25 + mergeCheckCache MergeCheckCache 26 + conflictErrorRegex = regexp.MustCompile(`^error: (.*):(\d+): (.*)$`) 26 27 ) 27 28 28 29 func init() { ··· 408 409 continue 409 410 } 410 411 411 - if match := regexp.MustCompile(`^error: (.*):(\d+): (.*)$`).FindStringSubmatch(line); len(match) >= 4 { 412 + if match := conflictErrorRegex.FindStringSubmatch(line); len(match) >= 4 { 412 413 if currentFile == "" { 413 414 currentFile = match[1] 414 415 }