mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-14 18:30:02 +08:00
perf: pre-allocate all known length arrays to avoid re-scaling (#5029)
Co-authored-by: Kevin Wan <wanjunfeng@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a2b98dbcf7
commit
130e1ba963
@@ -36,13 +36,13 @@ func genConfig(dir string, cfg *config.Config, api *spec.ApiSpec) error {
|
||||
}
|
||||
|
||||
authNames := getAuths(api)
|
||||
var auths []string
|
||||
auths := make([]string, 0, len(authNames))
|
||||
for _, item := range authNames {
|
||||
auths = append(auths, fmt.Sprintf("%s %s", item, jwtTemplate))
|
||||
}
|
||||
|
||||
jwtTransNames := getJwtTrans(api)
|
||||
var jwtTransList []string
|
||||
jwtTransList := make([]string, 0, len(jwtTransNames))
|
||||
for _, item := range jwtTransNames {
|
||||
jwtTransList = append(jwtTransList, fmt.Sprintf("%s %s", item, jwtTransTemplate))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user