go-mls
go-mls copied to clipboard
Consistent use of pointers
Right now, our APIs use a mix of pointers and direct object references. We should be more uniform in our approach here. Suggested guidelines:
- For structs representing messages (e.g., Welcome, Commit), fields are by value, except when optional
- For other structs (e.g., State, HPKEPrivateKey), fields are as produced / passed to APIs, thus usually pointers
- Fields in messages are by value, except when optional
- Objects are passed to/from API methods by reference (as pointers)
FWIW, it appears the conventional wisdom differs a bit from my thoughts above: https://goinbigdata.com/golang-pass-by-pointer-vs-pass-by-value/
The main thing I would like to avoid copying around is secrets / private keys. So maybe we can have a more value-oriented approach.
Once we have the initial version of end to end api, this might be good one to get started .. @bifurcation thoughts ?