4 ms·
Go JSON/v2 Package
- tedunangst 3y agoThis probably has the highest ratio of design doc to functional change I've ever read.
- demi56 3y agoThis is kinda small compared to other proposals
- deleted 3y ago[deleted]
- J_tt 3y agoSupporting custom date time formats in struct tags is a huge quality of life improvement, a lot of unnecessary boilerplate saved there
- sureglymop 3y agoDoes anyone know if there is a good "config validation" package in go? I want to read in a json config file from the user, validate it with a schema that even checks for missing keys or keys that shouldn't be in the file, then if there are errors I want to print to the user the exact line of the file that is the problem. The assumption is that the user will misconfigure something and should thus be informed.
- chipsfingrar 3y agoI haven’t come across anything specifically for this use case, but you could probably achieve this using either json-schema or by using struct tags from the go-playground/validator package.
- philosopher1234 3y agoCheck out cue lang
- c2xlZXB5Cg1 3y agoHow does one grok cuelang? Asking for a friend.
- ttymck 3y agovalidator has worked well for me, but it doesn't operate on files, rather it validates the structs after unmarshaling. https://pkg.go.dev/github.com/go-playground/validator/v10 https://pkg.go.dev/github.com/go-playground/validator/v10
- sureglymop 3y agoI am using validator now and it's okay. I did have to write some custom validators and it wasn't too well documented. Unfortunately it's a bit hard to generate the right error messages for the user to see exactly where the misconfiguration is.