Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
22a6eedc
Commit
22a6eedc
authored
May 30, 2017
by
Yang Guo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update semver to 3.5.0
parent
bcad534e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
522 additions
and
16 deletions
+522
-16
Godeps.json
Godeps/Godeps.json
+2
-2
BUILD
vendor/github.com/blang/semver/BUILD
+1
-0
README.md
vendor/github.com/blang/semver/README.md
+63
-14
package.json
vendor/github.com/blang/semver/package.json
+17
-0
range.go
vendor/github.com/blang/semver/range.go
+416
-0
semver.go
vendor/github.com/blang/semver/semver.go
+23
-0
No files found.
Godeps/Godeps.json
View file @
22a6eedc
...
@@ -308,8 +308,8 @@
...
@@ -308,8 +308,8 @@
},
},
{
{
"ImportPath"
:
"github.com/blang/semver"
,
"ImportPath"
:
"github.com/blang/semver"
,
"Comment"
:
"v3.
0.1
"
,
"Comment"
:
"v3.
5.0
"
,
"Rev"
:
"
31b736133b98f26d5e078ec9eb591666edfd091f
"
"Rev"
:
"
b38d23b8782a487059e8fc8773e9a5b228a77cb6
"
},
},
{
{
"ImportPath"
:
"github.com/boltdb/bolt"
,
"ImportPath"
:
"github.com/boltdb/bolt"
,
...
...
vendor/github.com/blang/semver/BUILD
View file @
22a6eedc
...
@@ -11,6 +11,7 @@ go_library(
...
@@ -11,6 +11,7 @@ go_library(
name = "go_default_library",
name = "go_default_library",
srcs = [
srcs = [
"json.go",
"json.go",
"range.go",
"semver.go",
"semver.go",
"sort.go",
"sort.go",
"sql.go",
"sql.go",
...
...
vendor/github.com/blang/semver/README.md
View file @
22a6eedc
...
@@ -40,10 +40,52 @@ Features
...
@@ -40,10 +40,52 @@ Features
-
Comparator-like comparisons
-
Comparator-like comparisons
-
Compare Helper Methods
-
Compare Helper Methods
-
InPlace manipulation
-
InPlace manipulation
-
Ranges
`>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1`
-
Sortable (implements sort.Interface)
-
Sortable (implements sort.Interface)
-
database/sql compatible (sql.Scanner/Valuer)
-
database/sql compatible (sql.Scanner/Valuer)
-
encoding/json compatible (json.Marshaler/Unmarshaler)
-
encoding/json compatible (json.Marshaler/Unmarshaler)
Ranges
------
A
`Range`
is a set of conditions which specify which versions satisfy the range.
A condition is composed of an operator and a version. The supported operators are:
-
`<1.0.0`
Less than
`1.0.0`
-
`<=1.0.0`
Less than or equal to
`1.0.0`
-
`>1.0.0`
Greater than
`1.0.0`
-
`>=1.0.0`
Greater than or equal to
`1.0.0`
-
`1.0.0`
,
`=1.0.0`
,
`==1.0.0`
Equal to
`1.0.0`
-
`!1.0.0`
,
`!=1.0.0`
Not equal to
`1.0.0`
. Excludes version
`1.0.0`
.
A
`Range`
can link multiple
`Ranges`
separated by space:
Ranges can be linked by logical AND:
-
`>1.0.0 <2.0.0`
would match between both ranges, so
`1.1.1`
and
`1.8.7`
but not
`1.0.0`
or
`2.0.0`
-
`>1.0.0 <3.0.0 !2.0.3-beta.2`
would match every version between
`1.0.0`
and
`3.0.0`
except
`2.0.3-beta.2`
Ranges can also be linked by logical OR:
-
`<2.0.0 || >=3.0.0`
would match
`1.x.x`
and
`3.x.x`
but not
`2.x.x`
AND has a higher precedence than OR. It's not possible to use brackets.
Ranges can be combined by both AND and OR
-
`>1.0.0 <2.0.0 || >3.0.0 !4.2.1`
would match
`1.2.3`
,
`1.9.9`
,
`3.1.1`
, but not
`4.2.1`
,
`2.1.1`
Range usage:
```
v, err := semver.Parse("1.2.3")
range, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0")
if range(v) {
//valid
}
```
Example
Example
-----
-----
...
@@ -103,23 +145,30 @@ if err != nil {
...
@@ -103,23 +145,30 @@ if err != nil {
}
}
```
```
Benchmarks
Benchmarks
-----
-----
BenchmarkParseSimple 5000000 328 ns/op 49 B/op 1 allocs/op
BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op
BenchmarkParseComplex 1000000 2105 ns/op 263 B/op 7 allocs/op
BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op
BenchmarkParseAverage 1000000 1301 ns/op 168 B/op 4 allocs/op
BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op
BenchmarkStringSimple 10000000 130 ns/op 5 B/op 1 allocs/op
BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op
BenchmarkStringLarger 5000000 280 ns/op 32 B/op 2 allocs/op
BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op
BenchmarkStringComplex 3000000 512 ns/op 80 B/op 3 allocs/op
BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op
BenchmarkStringAverage 5000000 387 ns/op 47 B/op 2 allocs/op
BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op
BenchmarkValidateSimple 500000000 7.92 ns/op 0 B/op 0 allocs/op
BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op
BenchmarkValidateComplex 2000000 923 ns/op 0 B/op 0 allocs/op
BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op
BenchmarkValidateAverage 5000000 452 ns/op 0 B/op 0 allocs/op
BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op
BenchmarkCompareSimple 100000000 11.2 ns/op 0 B/op 0 allocs/op
BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op
BenchmarkCompareComplex 50000000 40.9 ns/op 0 B/op 0 allocs/op
BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op
BenchmarkCompareAverage 50000000 43.8 ns/op 0 B/op 0 allocs/op
BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op
BenchmarkSort 5000000 436 ns/op 259 B/op 2 allocs/op
BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op
BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op
BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op
BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op
BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op
BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op
BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op
See benchmark cases at
[
semver_test.go
](
semver_test.go
)
See benchmark cases at
[
semver_test.go
](
semver_test.go
)
...
...
vendor/github.com/blang/semver/package.json
0 → 100644
View file @
22a6eedc
{
"author"
:
"blang"
,
"bugs"
:
{
"URL"
:
"https://github.com/blang/semver/issues"
,
"url"
:
"https://github.com/blang/semver/issues"
},
"gx"
:
{
"dvcsimport"
:
"github.com/blang/semver"
},
"gxVersion"
:
"0.10.0"
,
"language"
:
"go"
,
"license"
:
"MIT"
,
"name"
:
"semver"
,
"releaseCmd"
:
"git commit -a -m
\"
gx publish $VERSION
\"
"
,
"version"
:
"3.4.0"
}
vendor/github.com/blang/semver/range.go
0 → 100644
View file @
22a6eedc
This diff is collapsed.
Click to expand it.
vendor/github.com/blang/semver/semver.go
View file @
22a6eedc
...
@@ -200,6 +200,29 @@ func Make(s string) (Version, error) {
...
@@ -200,6 +200,29 @@ func Make(s string) (Version, error) {
return
Parse
(
s
)
return
Parse
(
s
)
}
}
// ParseTolerant allows for certain version specifications that do not strictly adhere to semver
// specs to be parsed by this library. It does so by normalizing versions before passing them to
// Parse(). It currently trims spaces, removes a "v" prefix, and adds a 0 patch number to versions
// with only major and minor components specified
func
ParseTolerant
(
s
string
)
(
Version
,
error
)
{
s
=
strings
.
TrimSpace
(
s
)
s
=
strings
.
TrimPrefix
(
s
,
"v"
)
// Split into major.minor.(patch+pr+meta)
parts
:=
strings
.
SplitN
(
s
,
"."
,
3
)
if
len
(
parts
)
<
3
{
if
strings
.
ContainsAny
(
parts
[
len
(
parts
)
-
1
],
"+-"
)
{
return
Version
{},
errors
.
New
(
"Short version cannot contain PreRelease/Build meta data"
)
}
for
len
(
parts
)
<
3
{
parts
=
append
(
parts
,
"0"
)
}
s
=
strings
.
Join
(
parts
,
"."
)
}
return
Parse
(
s
)
}
// Parse parses version string and returns a validated Version or error
// Parse parses version string and returns a validated Version or error
func
Parse
(
s
string
)
(
Version
,
error
)
{
func
Parse
(
s
string
)
(
Version
,
error
)
{
if
len
(
s
)
==
0
{
if
len
(
s
)
==
0
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment