Browse Source

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

for-closed-social
Lunny Xiao 5 years ago
committed by techknowlogick
parent
commit
5be1780045
5 changed files with 48 additions and 13 deletions
  1. +1
    -1
      go.mod
  2. +2
    -0
      go.sum
  3. +12
    -10
      vendor/github.com/mcuadros/go-version/compare.go
  4. +32
    -1
      vendor/github.com/mcuadros/go-version/group.go
  5. +1
    -1
      vendor/modules.txt

+ 1
- 1
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
- 0
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=

+ 12
- 10
vendor/github.com/mcuadros/go-version/compare.go 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

+ 32
- 1
vendor/github.com/mcuadros/go-version/group.go 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 {

+ 1
- 1
vendor/modules.txt 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

Loading…
Cancel
Save