代码规范过滤,移除冗余代码,替换掉不推荐的包

This commit is contained in:
孟帅
2023-05-30 12:09:40 +08:00
parent c8a808fcfd
commit b2ef3487d3
74 changed files with 564 additions and 741 deletions

View File

@@ -18,7 +18,7 @@ func GetOs(userAgent string) string {
return osName
}
strRe, _ := regexp.Compile("(?i:\\((.*?)\\))")
strRe, _ := regexp.Compile(`(?i:((.*?)))`)
userAgent = strRe.FindString(userAgent)
levelNames := ":micromessenger:dart:Windows NT:Windows Mobile:Windows Phone:Windows Phone OS:Macintosh|Macintosh:Mac OS:CrOS|CrOS:iPhone OS:iPad|iPad:OS:Android:Linux:blackberry:hpwOS:Series:Symbian:PalmOS:SymbianOS:J2ME:Sailfish:Bada:MeeGo:webOS|hpwOS:Maemo:"
@@ -83,7 +83,7 @@ func GetBrowser(userAgent string) string {
level := 0
for _, name := range names {
replaceRe, _ := regexp.Compile("(?i:[\\s?\\/0-9.]+)")
replaceRe, _ := regexp.Compile(`(?i:[\s?\/0-9.]+)`)
n := replaceRe.ReplaceAllString(name, "")
l := strings.Index(levelNames, fmt.Sprintf(":%s:", n))
if level == 0 {