xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Nick Rosbrook <rosbrookn@gmail.com>
To: George Dunlap <george.dunlap@citrix.com>
Cc: Nick Rosbrook <rosbrookn@ainfosec.com>,
	Xen-devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [Xen-devel] [PATCH v5 1/3] golang/xenlight: begin Go to C type marshaling
Date: Thu, 16 Jan 2020 11:50:19 -0500	[thread overview]
Message-ID: <CAEBZRSfZbeO6r2Qt1nfjQ_N0WCtu_xpwuZ1oS487uQ+=iXBAGw@mail.gmail.com> (raw)
In-Reply-To: <f6ac3a54-a848-e2d1-7604-da318c871513@citrix.com>

> Looks good!  Only one question:
>
> > +    if not is_castable:
> > +        s += 'if err := x.{}.toC(&xc.{}); err != nil {{\n'.format(goname,cname)
>
> Err should be defined function-wide at this point.  Are you using `:=`
> on purpose for some reason?  Would it make sense to make this `=` instead?

This is on purpose. IMO it's better to keep the variable scoped to the
if block when using short statement if syntax. If the desire is to
assign to the same `err` variable, then I would not use the short
statement. Reason being I think it helps readability; the short
statement syntax is handy, but it is easy to glance over and not
realize an assignment is being made.

Thanks,
-NR

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-01-16 16:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 21:00 [Xen-devel] [PATCH v5 0/3] generated Go libxl bindings using IDL Nick Rosbrook
2020-01-04 21:00 ` [Xen-devel] [PATCH v5 1/3] golang/xenlight: begin Go to C type marshaling Nick Rosbrook
2020-01-16 16:00   ` George Dunlap
2020-01-16 16:50     ` Nick Rosbrook [this message]
2020-01-16 16:56       ` George Dunlap
2020-01-04 21:00 ` [Xen-devel] [PATCH v5 2/3] golang/xenlight: implement keyed union Go to C marshaling Nick Rosbrook
2020-01-16 16:16   ` George Dunlap
2020-01-04 21:00 ` [Xen-devel] [PATCH v5 3/3] golang/xenlight: implement array " Nick Rosbrook
2020-01-16 16:20   ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEBZRSfZbeO6r2Qt1nfjQ_N0WCtu_xpwuZ1oS487uQ+=iXBAGw@mail.gmail.com' \
    --to=rosbrookn@gmail.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=rosbrookn@ainfosec.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).