Debian Codegraph @

README.md

raw symbols SCIP
1 # go-mvn-version
2
3 A Go library for parsing maven(java) package versions
4
5 go-mvn-version is a library for parsing and comparing versions
6
7 The implementation is based on [this specification](https://maven.apache.org/pom.html#Version_Order_Specification)
8
9 other reference: [maven implementation](https://github.com/apache/maven/blob/master/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java)
10
11
12 # Installation and Usage
13 Installation can be done with a normal go get:
14
15 ```
16 $ go get github.com/masahiro331/go-mvn-version
17 ```
18
19 # Version Parsing and Comparison
20 ```
21 import "github.com/masahiro331/go-mvn-version"
22
23 v1, err := version.NewVersion("10-snapshot")
24 v2, err := version.NewVersion("10-b1")
25
26 if v1.GreaterThan(*v2) {
27 fmt.Printf("%s is greater than %s", v1, v2)
28 }
29 ```
30
31 # WARNING
32 This implementation based on the [maven specification](https://maven.apache.org/pom.html#Version_Order_Specification), but not the [maven implementation](https://github.com/apache/maven/blob/master/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java).
33
34 See issues: [ComparableVersion incorrectly parses certain version strings](https://issues.apache.org/jira/browse/MNG-6420)
35 ```
36 $ go test .
37 --- FAIL: TestVersionsNumber (0.00s)
38 version_test.go:415: expected: 2.0.a < 2.0.0.a
39 version_test.go:418: expected: 2.0.0.a > 2.0.a
40 FAIL
41 FAIL github.com/masahiro331/go-mvn-version/pkg/version 0.005s
42 FAIL
43 ```
44
45 ----
46
47 # License
48 Apache License 2.0
49
50 # Author
51 Masahiro Fujimura