On 11/15/19 7:44 PM, Nick Rosbrook wrote: > From: Nick Rosbrook <rosbro...@ainfosec.com> > > Define Defbool as struct analagous to the C type, and define the type > 'defboolVal' that represent true, false, and default defbool values. > > Implement Set, Unset, SetIfDefault, IsDefault, Val, and String functions > on Defbool so that the type can be used in Go analagously to how its > used in C. > > Finally, implement fromC and toC functions.
The R-b stands, just adding in a comment: I implemented some tests for these methods to make sure everything worked as expected (they did); but there's an unexpected side-effect: - *_test.go files cannot `import "C"` - The fromC / toC methods aren't exported So it's not possible to do the following check: var b Defbool b.Set(true) cb, err := b.toC() if ( !C.libxl_defbool_val(cb) ) { // report an error } defbool_test.go can't `import "C"`, so it can't call C.libxl_defbool_val(). We could make an external xenlighttest package, but that wouldn't be able to call toC(). (I suppose we could write "proxy" functions for every such function we might want to check, but that seems excessive.) -George _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel