Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
Provide workaround for segmentation fault (fixes #54)
Browse files Browse the repository at this point in the history
  • Loading branch information
moqmar authored Dec 16, 2019
1 parent 6c1b23a commit 2a4daae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion here/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func (i Info) Parse(p string) (Path, error) {
return i.build("", "", "")
}

if pathrx == nil {
// Please do not move the initialization down to the declaration, see #54
pathrx = regexp.MustCompile("([^:]+)(:(/.+))?")
}
res := pathrx.FindAllStringSubmatch(p, -1)
if len(res) == 0 {
return Path{}, fmt.Errorf("could not parse %q", p)
Expand Down Expand Up @@ -60,4 +64,4 @@ func (i Info) build(p, pkg, name string) (Path, error) {
return pt, nil
}

var pathrx = regexp.MustCompile("([^:]+)(:(/.+))?")
var pathrx *regexp.Regexp

0 comments on commit 2a4daae

Please sign in to comment.