Run of fresh-snapshots for golang-github-knqyf263-go-deb-version

Try this locally (using silver-platter):

debian-svp new-upstream --snapshot golang-github-knqyf263-go-deb-version 

Merge these changes:

Summary

Merged new upstream version: 0.0~git20190517.09fca49 (was: 0.0~git20170509.9865fe1).

Diff

diff --git a/debian/changelog b/debian/changelog
index bcc34a9..c9632fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-knqyf263-go-deb-version (0.0~git20190517.09fca49-1) UNRELEASED; urgency=medium
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Sun, 23 Jun 2019 04:23:28 +0000
+
 golang-github-knqyf263-go-deb-version (0.0~git20170509.9865fe1-2) unstable; urgency=medium
 
   * Move to salsa.debian.org.
diff --git a/version.go b/version.go
index ce3ca9b..e99d2e9 100644
--- a/version.go
+++ b/version.go
@@ -120,6 +120,12 @@ func verifyDebianRevision(str string) error {
 	return nil
 }
 
+// Valid validates the version
+func Valid(ver string) bool {
+	_, err := NewVersion(ver)
+	return err == nil
+}
+
 // Equal returns whether this version is equal with another version.
 func (v1 *Version) Equal(v2 Version) bool {
 	return v1.Compare(v2) == 0
diff --git a/version_test.go b/version_test.go
index bf9b7e7..1288140 100644
--- a/version_test.go
+++ b/version_test.go
@@ -73,6 +73,33 @@ func TestNewVersion(t *testing.T) {
 	}
 }
 
+func TestValid(t *testing.T) {
+	cases := []struct {
+		version  string
+		expected bool
+	}{
+		{"1.2.3", true},
+		{"1:1.2.3", true},
+		{"A:1.2.3", false},
+		{"-1:1.2.3", false},
+		{"6.0-4.el6.x86_64", true},
+		{"6.0-9ubuntu1.5", true},
+		{"2:7.4.052-1ubuntu3.1", true},
+		{"2:-1ubuntu3.1", false},
+		{"2:A7.4.052-1ubuntu3.1", false},
+		{"2:7.4.!052-1ubuntu3.1", false},
+		{"7.4.052-!1ubuntu3.1", false},
+	}
+
+	for _, tc := range cases {
+		actual := Valid(tc.version)
+		if actual != tc.expected {
+			t.Fatalf(
+				"valid: %s\nexpected: %t\nactual: %t",
+				tc.version, tc.expected, actual)
+		}
+	}
+}
 func TestEqual(t *testing.T) {
 	cases := []struct {
 		v1       Version

Full worker log Full build log