[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 1/3] golang/xenlight: begin Go to C type marshaling



> 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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.