ardanlabs / service

Starter-kit for writing services in Go using Kubernetes.
https://www.ardanlabs.com
Apache License 2.0
3.4k stars 613 forks source link

refine make built-in function allocates add len #362

Closed mrbardia72 closed 1 month ago

mrbardia72 commented 1 month ago

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

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

ardan-bkennedy commented 1 month ago

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.

ardan-bkennedy commented 1 month ago

Fixed by PR 363