google / go-dap

Go implementation of the Debug Adapter Protocol
Apache License 2.0
127 stars 22 forks source link

Make omitempty structs pointers. #75

Closed rehmsen closed 1 year ago

rehmsen commented 1 year ago

This is needed so that unset JSON values get initialized to nil in Go instead of the zero struct. The zero struct is indistinguishable from an explicitly set struct with zero values, and will get serialized despite "omitempty". nil on the other hand will be dropped, as expected.

Fixes #72.

rehmsen commented 1 year ago

Thanks for taking a look Suzy. What would it take to get this merged?

suzmue commented 1 year ago

Thanks for taking a look Suzy. What would it take to get this merged?

Would you mind pulling in the latest commits from tip? There is a fix to the CI and I would like to see the tests run against this change. Thank you!

I'll finish reviewing the code as well.

suzmue commented 1 year ago

@rehmsen Looks like just a couple of test cases need to be fixed up! They appear to all be intentional differences in behavior from this change that just need to be reflected in the tests located in cmd/mockserver/server_test.go.

rehmsen commented 1 year ago

Weird, it took a while to run. I was not able to run them locally completely (failed to install staticcheck I think), but the part that ran I fixed. Will it automatically rerun to check if they are all fixed now?