-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enforce more structure on structs #77
Comments
Looking at go-ethereum they use https://godoc.org/github.com/fjl/gencodec to do something similar, but only for marshal and unmarshal operations. |
@phritz @whyrusleeping thoughts? |
My reaction: this has the feeling of one of those things that seems obviously like a good at first blush (who wouldn't want valid objects?!) but that ends up encoding a rigidity that makes things hard to change. For example in tests always having to a have a fully formed Thingy even if you are only need part of it, or making it hard to change a struct once the system is launched. BTW while it is a contentious topic, having required fields in your serialization format is generally considered harmful (eg (Sorry had to delete the last comment because auto-linking caused our issue to show up on the linked issue) |
(@phritz btw, that autolinking is only visible by people who can access this repo, its scared me before but i verified it didnt show up when i wasnt logged in) This seems interesting. But I agree with @phritz, this is a decelerating change, not an accelerating one. We can consider something like this after we have a running testnet. |
I would like to propose to use something like https://github.com/go-playground/validator to allow simple validation of the content of structs, both on creation and on marshal/unmarshal.
Using the above package we could write something like this
The text was updated successfully, but these errors were encountered: