Honour metadata added to version
closes https://github.com/therootcompany/go-gitver/issues/2
This commit is contained in:
parent
1638772379
commit
ff518824b4
|
@ -14,7 +14,7 @@ var gitVer *regexp.Regexp
|
|||
|
||||
func init() {
|
||||
// exactly vX.Y.Z (go-compatible semver)
|
||||
exactVer = regexp.MustCompile(`^v\d+\.\d+\.\d+$`)
|
||||
exactVer = regexp.MustCompile(`^v\d+\.\d+\.\d+(\+.*)?$`)
|
||||
|
||||
// vX.Y.Z-n-g0000000 git post-release, semver prerelease
|
||||
// vX.Y.Z-dirty git post-release, semver prerelease
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package gitver
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Example_semVer_build_meta() {
|
||||
fmt.Println(semVer("v1.5.0+something1"))
|
||||
fmt.Println(semVer("v1.5.0"))
|
||||
|
||||
// Output:
|
||||
// 1.5.0+something1 <nil>
|
||||
// 1.5.0 <nil>
|
||||
}
|
Loading…
Reference in New Issue