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 | |
parent | eb8632b20b8a3c3b51359860e12f2197cd03866e (diff) | |
download | gitea-5be17800457528e8047677c0e3d33cda6896140b.tar.gz gitea-5be17800457528e8047677c0e3d33cda6896140b.zip |
update github.com/mcuadros/go-version to v0.0.0-20190308113854-92cdf37c5b75 (#6815)
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-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 |
5 files changed, 48 insertions, 13 deletions
@@ -84,7 +84,7 @@ require ( github.com/mattn/go-oci8 v0.0.0-20190320171441-14ba190cf52d // indirect github.com/mattn/go-sqlite3 v1.10.0 github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mcuadros/go-version v0.0.0-20171003094716-88e56e02bea1 + github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect github.com/msteinert/pam v0.0.0-20151204160544-02ccfbfaf0cc @@ -223,6 +223,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mcuadros/go-version v0.0.0-20171003094716-88e56e02bea1 h1:4yXas1DDHpauOfuyfmAMm+EB+SiqPKEoTdc88XEJHsc= github.com/mcuadros/go-version v0.0.0-20171003094716-88e56e02bea1/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo= +github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX7QIQiEwLdRVr3RoMG+i0SbBO1Qu+7yVk= +github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo= github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a h1:d18LCO3ctH2kugUqt0pEyKKP8L+IYrocaPqGFilhTKk= github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= 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 |