diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-05-01 23:44:16 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-05-01 11:44:16 -0400 |
commit | 5be17800457528e8047677c0e3d33cda6896140b (patch) | |
tree | 9f992f7b5a8789f11908cbae13e1bc73fb714bb1 /vendor | |
parent | eb8632b20b8a3c3b51359860e12f2197cd03866e (diff) | |
download | gitea-5be17800457528e8047677c0e3d33cda6896140b.tar.gz gitea-5be17800457528e8047677c0e3d33cda6896140b.zip |
update github.com/mcuadros/go-version to v0.0.0-20190308113854-92cdf37c5b75 (#6815)
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/mcuadros/go-version/compare.go | 22 | ||||
-rw-r--r-- | vendor/github.com/mcuadros/go-version/group.go | 33 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
3 files changed, 45 insertions, 12 deletions
diff --git a/vendor/github.com/mcuadros/go-version/compare.go b/vendor/github.com/mcuadros/go-version/compare.go index 98e14fa8ec..546f071e57 100644 --- a/vendor/github.com/mcuadros/go-version/compare.go +++ b/vendor/github.com/mcuadros/go-version/compare.go @@ -11,16 +11,18 @@ var regexpDotBeforeDigit = regexp.MustCompile(`([^.\d]+)`) var regexpMultipleDots = regexp.MustCompile(`\.{2,}`) var specialForms = map[string]int{ - "dev": -6, - "alpha": -5, - "a": -5, - "beta": -4, - "b": -4, - "RC": -3, - "rc": -3, - "#": -2, - "p": 1, - "pl": 1, + "SNAPSHOT": -7, + "snapshot": -7, + "dev": -6, + "alpha": -5, + "a": -5, + "beta": -4, + "b": -4, + "RC": -3, + "rc": -3, + "#": -2, + "p": 1, + "pl": 1, } var unknownForm int = -7 diff --git a/vendor/github.com/mcuadros/go-version/group.go b/vendor/github.com/mcuadros/go-version/group.go index b25a30c0c0..02a8eb48f1 100644 --- a/vendor/github.com/mcuadros/go-version/group.go +++ b/vendor/github.com/mcuadros/go-version/group.go @@ -4,6 +4,7 @@ import ( "regexp" "strconv" "strings" + "sync" ) type ConstraintGroup struct { @@ -241,8 +242,38 @@ func (self *ConstraintGroup) parseConstraint(constraint string) []*Constraint { return []*Constraint{{constraint, stabilityModifier}} } +// PCRegMap : PreCompiled Regex Map +type PCRegMap struct { + sync.RWMutex + m map[string]*regexp.Regexp +} + +// MustCompile : to replace regexp.MustCompile in RegFind. +func (p *PCRegMap) MustCompile(pattern string) *regexp.Regexp { + p.RLock() + ret, exist := p.m[pattern] + p.RUnlock() + if exist { + return ret + } + ret = regexp.MustCompile(pattern) + p.Lock() + p.m[pattern] = ret + p.Unlock() + return ret +} + +var ( + regexpCache *PCRegMap +) + +func init() { + regexpCache = new(PCRegMap) + regexpCache.m = make(map[string]*regexp.Regexp) +} + func RegFind(pattern, subject string) []string { - reg := regexp.MustCompile(pattern) + reg := regexpCache.MustCompile(pattern) matched := reg.FindAllStringSubmatch(subject, -1) if matched != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 08db5c7113..dccfd2495f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -243,7 +243,7 @@ github.com/mattn/go-isatty github.com/mattn/go-sqlite3 # github.com/matttproud/golang_protobuf_extensions v1.0.1 github.com/matttproud/golang_protobuf_extensions/pbutil -# github.com/mcuadros/go-version v0.0.0-20171003094716-88e56e02bea1 +# github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 github.com/mcuadros/go-version # github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a github.com/microcosm-cc/bluemonday |