ardanlabs / service

Starter-kit for writing services in Go using Kubernetes.

Home Page:https://www.ardanlabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refine make built-in function allocates add len

mrbardia72 opened this issue · comments

https://github.com/ardanlabs/service/blob/master/foundation/validate/errors.go#L39

m := make(map[string]string) ===> m := make(map[string]string,len(fe))

You could do this but it won't make any difference in the performance of the app. This is a failure condition, not normal path. Even if it was normal path, I think it's insignificant. If this came up in a profile, then for sure this needs to be done.

All that being said, if you want to provide a PR, I'll accept it.

Fixed by PR 363