Skip to content

Commit

Permalink
optimize: pre alloc slice
Browse files Browse the repository at this point in the history
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
  • Loading branch information
rfyiamcool committed Feb 25, 2024
1 parent 412e31a commit 039dc50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slug.go
Expand Up @@ -145,7 +145,7 @@ func MakeLang(s string, lang string) (slug string) {
// order. Many passes, on one substitution another one could apply.
func Substitute(s string, sub map[string]string) (buf string) {
buf = s
var keys []string
var keys = make([]string, len(sub))
for k := range sub {
keys = append(keys, k)
}
Expand Down

0 comments on commit 039dc50

Please sign in to comment.