diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-12-10 18:23:34 -0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-12-11 10:23:34 +0800 |
commit | 58a7de2aeae7ca08fc886d3586ee077094a9bc6c (patch) | |
tree | 4955f3d669bc4f6d60a79b1e5e0e70425d7eff3e /vendor/github.com/mcuadros | |
parent | 682ac11958fed286bb0ca4d488084953f50779ef (diff) | |
download | gitea-58a7de2aeae7ca08fc886d3586ee077094a9bc6c.tar.gz gitea-58a7de2aeae7ca08fc886d3586ee077094a9bc6c.zip |
Update code.gitea.io/git (#3137)
Diffstat (limited to 'vendor/github.com/mcuadros')
-rw-r--r-- | vendor/github.com/mcuadros/go-version/README.md | 4 | ||||
-rw-r--r-- | vendor/github.com/mcuadros/go-version/compare.go | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/vendor/github.com/mcuadros/go-version/README.md b/vendor/github.com/mcuadros/go-version/README.md index b6addcd0e7..a64c0a68d9 100644 --- a/vendor/github.com/mcuadros/go-version/README.md +++ b/vendor/github.com/mcuadros/go-version/README.md @@ -1,4 +1,4 @@ -go-version [![Build Status](https://travis-ci.org/mcuadros/go-version.png?branch=master)](https://travis-ci.org/mcuadros/go-version) [![GoDoc](https://godoc.org/github.com/mcuadros/go-version?status.png)](http://godoc.org/github.com/mcuadros/go-version) +go-version [![Build Status](https://travis-ci.org/mcuadros/go-version.svg?branch=master)](https://travis-ci.org/mcuadros/go-version) [![GoDoc](https://godoc.org/github.com/mcuadros/go-version?status.svg)](http://godoc.org/github.com/mcuadros/go-version) ============================== Version normalizer and comparison library for go, heavy based on PHP version_compare function and Version comparsion libs from [Composer](https://github.com/composer/composer) PHP project @@ -78,5 +78,3 @@ License ------- MIT, see [LICENSE](LICENSE) - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mcuadros/go-version/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/vendor/github.com/mcuadros/go-version/compare.go b/vendor/github.com/mcuadros/go-version/compare.go index 84dc3fa1ff..98e14fa8ec 100644 --- a/vendor/github.com/mcuadros/go-version/compare.go +++ b/vendor/github.com/mcuadros/go-version/compare.go @@ -23,6 +23,8 @@ var specialForms = map[string]int{ "pl": 1, } +var unknownForm int = -7 + // Compares two version number strings, for a particular relationship // // Usage @@ -155,5 +157,15 @@ func numVersion(value string) int { return special } - return -7 + return unknownForm +} + +func ValidSimpleVersionFormat(value string) bool { + normalized := Normalize(value) + for _, component := range prepVersion(normalized) { + if numVersion(component) == unknownForm { + return false + } + } + return true } |