On Wed, Jul 26, 2023 at 12:29:46PM -0500, Eric Blake wrote: > Among other things, the 'gofmt' tool flagged our use of a single-line > if/else statement for returning an RBool value, recommending we expand > it to multiple lines. But we don't need that much typing, when we can > just directly compute the boolean result in place. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > generator/GoLang.ml | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/generator/GoLang.ml b/generator/GoLang.ml > index 82d73ed6..0aa83bdc 100644 > --- a/generator/GoLang.ml > +++ b/generator/GoLang.ml > @@ -366,8 +366,7 @@ let > | RErr -> > pr " return nil\n" > | RBool -> > - pr " r := int (ret)\n"; > - pr " if r != 0 { return true, nil } else { return false, nil }\n" > + pr " return int (ret) != 0, nil\n" > | RStaticString -> > pr " /* ret is statically allocated, do not free it. */\n"; > pr " r := C.GoString (ret);\n";
Obvious improvement. Reviewed-by: Richard W.M. Jones <rjo...@redhat.com> (upstream in commit a6ba611396) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs