pelletier / go-toml

Go library for the TOML file format
https://github.com/pelletier/go-toml
Other
1.69k stars 206 forks source link

Reduce init time allocation when declaring types used for reflect #821

Closed dolmen closed 1 year ago

dolmen commented 1 year ago

In declaration of types used for reflect, use reflect.TypeOf((*T)).Elem() instead of reflect.TypeOf(T{}) to avoid init-time allocations.

See related stdlib issue: https://github.com/golang/go/issues/55973

dolmen commented 1 year ago

Blocked on my side by dolmen/github-keygen#47 as I have to sign my commits.

pelletier commented 1 year ago

No worries for signed commits. Merged it, thanks a lot for the patch!