0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-26 07:44:29 +01:00

update github.com/mcuadros/go-version to v0.0.0-20190308113854-92cdf37c5b75 (#6815)

This commit is contained in:
Lunny Xiao 2019-05-01 23:44:16 +08:00 committed by techknowlogick
parent eb8632b20b
commit 5be1780045
5 changed files with 48 additions and 13 deletions

2
go.mod
View file

@ -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

2
go.sum
View file

@ -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=

View file

@ -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

View file

@ -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 {

2
vendor/modules.txt vendored
View file

@ -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