[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v1 0/8] qapi: add generator for Golang interface
From: |
Andrea Bolognani |
Subject: |
Re: [RFC PATCH v1 0/8] qapi: add generator for Golang interface |
Date: |
Tue, 19 Apr 2022 11:42:08 -0700 |
On Tue, Apr 19, 2022 at 11:12:28AM -0700, Andrea Bolognani wrote:
> Dealing with errors and commands that don't have a return value might
> require us to have generic CommandResult wrapper after all, but we
> should really try as hard as we can to stick to type safe interfaces.
On second thought, this wouldn't actually need to be generic: we
could have something like
type TraceEventGetStateResult struct {
Result TraceEventInfo `json:"return"`
Error *Error `json:"error"`
}
and the caller would check that res.Error is nil before accessing
res.Result.
Commands for which a return value is not expected would just have the
Error part in their corresponding Result struct, and those that can
either return an object or nothing (are there actually any like
that?) could have a pointer as the Result member.
--
Andrea Bolognani / Red Hat / Virtualization
- [RFC PATCH v1 0/8] qapi: add generator for Golang interface, Victor Toso, 2022/04/01
- [RFC PATCH v1 1/8] qapi: golang: Generate qapi's enum types in Go, Victor Toso, 2022/04/01
- [RFC PATCH v1 2/8] qapi: golang: Generate qapi's alternate types in Go, Victor Toso, 2022/04/01
- [RFC PATCH v1 3/8] qapi: golang: Generate qapi's struct types in Go, Victor Toso, 2022/04/01
- [RFC PATCH v1 4/8] qapi: golang: Generate qapi's union types in Go, Victor Toso, 2022/04/01
- [RFC PATCH v1 5/8] qapi: golang: Generate qapi's event types in Go, Victor Toso, 2022/04/01
- [RFC PATCH v1 7/8] qapi: golang: Add CommandResult type to Go, Victor Toso, 2022/04/01
- [RFC PATCH v1 8/8] qapi: golang: document skip function visit_array_types, Victor Toso, 2022/04/01
- [RFC PATCH v1 6/8] qapi: golang: Generate qapi's command types in Go, Victor Toso, 2022/04/01
- Re: [RFC PATCH v1 0/8] qapi: add generator for Golang interface, Andrea Bolognani, 2022/04/19
- Re: [RFC PATCH v1 0/8] qapi: add generator for Golang interface, Markus Armbruster, 2022/04/26