Skip to content

Commit

Permalink
refactor: move the regex compilation before it is used
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarneo committed Mar 16, 2022
1 parent 4b3bf15 commit fd55b43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ const (
PATTERN = "([a-zA-Z0-9-]+)[^*](.*)"
)

// Pre define the compiler
var pattern *regexp.Regexp = regexp.MustCompile(PATTERN)

type headers struct {
headers map[string]string
}

func ParseHeaders(headersFileContent []string) headers {
pattern := regexp.MustCompile(PATTERN)

h := headers{
headers: make(map[string]string, 0),
}
Expand Down

0 comments on commit fd55b43

Please sign in to comment.