On 7/26/23 19:29, 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 <eblake(a)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";
Nice!
Reviewed-by: Laszlo Ersek <lersek(a)redhat.com>