Indeed, thanks!
On Friday, March 17, 2017 at 5:04:30 AM UTC+1, Nigel Tao wrote:
>
> This is tangential, but if we're talking about style, you might be
> able to simplify this line
> ret = PropertiesList(ret).Append(PropertiesList(temp))
> to be
> ret = PropertiesList(ret).Append(temp)
> if t
This is tangential, but if we're talking about style, you might be
able to simplify this line
ret = PropertiesList(ret).Append(PropertiesList(temp))
to be
ret = PropertiesList(ret).Append(temp)
if the PropertiesList underlying type and the temp variable's type are
what I'm guessing they are: []*Pro
yeah, i did write it like it before,
but i want stop to shadow my variables as much as possible,
i found mistakes happens too easily with that writing.
On Thursday, March 16, 2017 at 7:28:17 PM UTC+1, rog wrote:
>
> I'd be inclined to write it something like this:
>
> https://play.golang.org/p
I d like to, but when I write,
// Load returns the list of partition found and their properties.
func (l *LinuxLoader) Load() ([]*Properties, error) {
//-
ret := []*Properties{}
if temp, err := runDf(); err != nil {
return ret, err
}
ret = PropertiesList(ret).Append(Pr
I'd be inclined to write it something like this:
https://play.golang.org/p/_CRQ86vHfq
On 16 March 2017 at 12:11, wrote:
> Hi,
>
> golint will report
>
> if block ends with a return statement, so drop this else and outdent its
> block (move short variable declaration to its own line if necessar
Early returns are fine. You don't need all those else blocks.
// Load returns the list of partition found and their properties.
func (l *LinuxLoader) Load() ([]*Properties, error) {
//-
ret := []*Properties{}
if temp, err := runDf(); err != nil {
return ret, err
}
ret
It's saying you don't need the else clauses since you have returned in
the if clause.
On Thu, 16 Mar 2017, at 05:11 PM, mhhc...@gmail.com wrote:
> Hi,
>
> golint will report
>
> if block ends with a return statement, so drop this else and outdent
> its block (move short variable declarat
Hi,
golint will report
if block ends with a return statement, so drop this else and outdent its
block (move short variable declaration to its own line if necessary)
(golint)
for this code,
// Load returns the list of partition found and their properties.
func (l *LinuxLoader) Load() ([]*