Chore: Use strings.ReplaceAll and preallocate containers (#58483)

This commit is contained in:
Sasha Melentyev
2022-11-09 17:17:09 +01:00
committed by GitHub
parent 2dfe0a4060
commit febcaeff3a
6 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -96,8 +96,8 @@ func getWildcards(pattern string) (string, []string) {
// getRawPattern removes all regexp but keeps wildcards for building URL path.
func getRawPattern(rawPattern string) string {
rawPattern = strings.Replace(rawPattern, ":int", "", -1)
rawPattern = strings.Replace(rawPattern, ":string", "", -1)
rawPattern = strings.ReplaceAll(rawPattern, ":int", "")
rawPattern = strings.ReplaceAll(rawPattern, ":string", "")
for {
startIdx := strings.Index(rawPattern, "(")