Commit 1e623f88 authored by Henry's avatar Henry

added test to not commit bad version numbers

parent deb9aebc
......@@ -35,13 +35,16 @@ var currentVersion *semver.Version
func init() {
var err error
currentVersion, err = semver.NewVersion(Version)
currentVersion, err = parseVersion()
if err != nil {
log.Error("The const Version literal in version.go needs to be in semver format: %s \n", Version)
log.Error("illegal version number in code: %q\n", Version)
os.Exit(1)
}
}
func parseVersion() (*semver.Version, error) {
return semver.NewVersion(Version)
}
func CheckForUpdates() error {
resp, err := http.Get(EndpointURLLatestReleases)
if err != nil {
......
package updates
import "testing"
// TestParseVersion just makes sure that we dont commit a bad version number
func TestParseVersion(t *testing.T) {
_, err := parseVersion()
if err != nil {
t.Fatal(err)
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment