diff --git a/gitver/gitver.go b/gitver/gitver.go index 1c00863..2575595 100644 --- a/gitver/gitver.go +++ b/gitver/gitver.go @@ -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 diff --git a/gitver/gitver_test.go b/gitver/gitver_test.go new file mode 100644 index 0000000..8760c78 --- /dev/null +++ b/gitver/gitver_test.go @@ -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 + // 1.5.0 +}