forked from mirror/pkger
Merge pull request #55 from moqmar/master
Provide workaround for segmentation fault (fixes #54)
This commit is contained in:
commit
6217c988eb
|
@ -19,6 +19,10 @@ func (i Info) Parse(p string) (Path, error) {
|
||||||
return i.build("", "", "")
|
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)
|
res := pathrx.FindAllStringSubmatch(p, -1)
|
||||||
if len(res) == 0 {
|
if len(res) == 0 {
|
||||||
return Path{}, fmt.Errorf("could not parse %q", p)
|
return Path{}, fmt.Errorf("could not parse %q", p)
|
||||||
|
@ -60,4 +64,4 @@ func (i Info) build(p, pkg, name string) (Path, error) {
|
||||||
return pt, nil
|
return pt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathrx = regexp.MustCompile("([^:]+)(:(/.+))?")
|
var pathrx *regexp.Regexp
|
||||||
|
|
Loading…
Reference in New Issue