Open
Description
In this fork, I added support for the following:
{[][]string{{"~1.2.1"}}, [][]string{{"<1.3.0", ">=1.2.1"}}},
{[][]string{{"^1.2.1"}}, [][]string{{"<2.0.0", ">=1.2.1"}}},
{[][]string{{"~>1.2.x"}}, [][]string{{">=1.2.0"}}},
{[][]string{{"~>1.x"}}, [][]string{{">=1.0.0"}}},
{[][]string{{"1.*"}}, [][]string{{">=1.0.0", "<2.0.0"}}},
{[][]string{{"1.2.*"}}, [][]string{{">=1.2.0", "<1.3.0"}}},
{[][]string{{"*"}}, [][]string{{">=0.0.0"}}},
{[][]string{{"8.0.0 - 10.0.0"}}, [][]string{{"<10.0.0", ">=8.0.0"}}},
{[][]string{{"8 - 10"}}, [][]string{{"<10.0.0", ">=8.0.0"}}},
{[][]string{{"8 - 10.1"}}, [][]string{{"<10.1.0", ">=8.0.0"}}},
{[][]string{{" 8 "}}, [][]string{{"8.0.0"}}},
{[][]string{{" 800000 "}}, [][]string{{"800000.0.0"}}},
{[][]string{{" ~7.x "}}, [][]string{{"<8.0.0", ">=7.0.0"}}},
{[][]string{{" ~7.0.x "}}, [][]string{{"<7.1.0", ">=7.0.0"}}},
{[][]string{{" ~* "}}, [][]string{{">=0.0.0"}}},
It does not allocate more memory. But, it's about 8% slower. Do you want me submit a PR?
goos: darwin
goarch: amd64
pkg: github.com/Jarred-Sumner/semver/v4
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
BenchmarkRangeParseSimple-16 2402451 493.4 ns/op 224 B/op 7 allocs/op
BenchmarkRangeParseAverage-16 1235457 967.9 ns/op 456 B/op 13 allocs/op
BenchmarkRangeParseComplex-16 392412 3129 ns/op 1736 B/op 39 allocs/op
BenchmarkRangeMatchSimple-16 100000000 11.32 ns/op 0 B/op 0 allocs/op
BenchmarkRangeMatchAverage-16 48316423 25.28 ns/op 0 B/op 0 allocs/op
BenchmarkRangeMatchComplex-16 17318359 70.28 ns/op 0 B/op 0 allocs/op
BenchmarkRangeMatchNPM-16 27442455 43.70 ns/op 0 B/op 0 allocs/op
BenchmarkParseSimple-16 8453367 139.5 ns/op 48 B/op 1 allocs/op
BenchmarkParseComplex-16 1795279 687.0 ns/op 256 B/op 7 allocs/op
BenchmarkParseAverage-16 2672629 466.3 ns/op 163 B/op 4 allocs/op
BenchmarkParseTolerantAverage-16 3093957 394.1 ns/op 132 B/op 4 allocs/op
BenchmarkStringSimple-16 40966444 30.76 ns/op 5 B/op 1 allocs/op
BenchmarkStringLarger-16 17750650 65.63 ns/op 32 B/op 2 allocs/op
BenchmarkStringComplex-16 12103804 98.85 ns/op 80 B/op 3 allocs/op
BenchmarkStringAverage-16 13836576 89.55 ns/op 45 B/op 2 allocs/op
BenchmarkValidateSimple-16 441872518 2.589 ns/op 0 B/op 0 allocs/op
BenchmarkValidateComplex-16 7224438 151.2 ns/op 0 B/op 0 allocs/op
BenchmarkValidateAverage-16 13011160 88.88 ns/op 0 B/op 0 allocs/op
BenchmarkCompareSimple-16 309173464 3.999 ns/op 0 B/op 0 allocs/op
BenchmarkCompareComplex-16 82620462 12.37 ns/op 0 B/op 0 allocs/op
BenchmarkCompareAverage-16 68264864 17.24 ns/op 0 B/op 0 allocs/op
BenchmarkSort-16 7555494 160.2 ns/op 248 B/op 2 allocs/op
PASS
ok github.com/Jarred-Sumner/semver/v4 31.099s
Fair warning that this is my ~4th day of writing go.
Metadata
Metadata
Assignees
Labels
No labels