1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Minor code cleanup.

This commit is contained in:
Ferdinand Mütsch
2019-11-07 23:11:19 +01:00
parent 121b8c9885
commit fe1cc3ac88
7 changed files with 21 additions and 21 deletions

View File

@ -22,7 +22,7 @@ func ParseUserAgent(ua string) (string, string, error) {
re := regexp.MustCompile(`^wakatime\/[\d+.]+\s\((\w+).*\)\s.+\s(\w+)\/.+$`)
groups := re.FindAllStringSubmatch(ua, -1)
if len(groups) == 0 || len(groups[0]) != 3 {
return "", "", errors.New("Failed to parse user agent string")
return "", "", errors.New("failed to parse user agent string")
}
return groups[0][1], groups[0][2], nil
}