From d7dc37b3c4bdcaf97c5cab1ed5a8922e73aa629c Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 20 Feb 2018 08:03:34 +0100 Subject: [PATCH] There are more numbers in the Go version now --- cmd/ursrv/analytics.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/ursrv/analytics.go b/cmd/ursrv/analytics.go index 93a7cf5b..71d77d67 100644 --- a/cmd/ursrv/analytics.go +++ b/cmd/ursrv/analytics.go @@ -1,6 +1,7 @@ package main import ( + "regexp" "sort" "strings" ) @@ -139,9 +140,11 @@ func byPlatform(s string) string { return s } +var numericGoVersion = regexp.MustCompile(`^go[0-9]\.[0-9]+`) + func byCompiler(s string) string { - if strings.HasPrefix(s, "go1.") && len(s) >= 5 { - return s[:5] + if m := numericGoVersion.FindString(s); m != "" { + return m } return "Other" }