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 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() ([]*Properties, error) {    //-    ret :=
> []*Properties{}
>
>     if temp, err := runDf(); err != nil {    return ret, err } else {
>     ret = PropertiesList(ret).Append(PropertiesList(temp)) } //- if
>     temp, err := runLsLabel(); err != nil {    return ret, err } else
>     {    ret = PropertiesList(ret).Append(PropertiesList(temp)) } //-
>     if temp, err := runLsUsb(); err != nil {    return ret, err } else
>     {    ret = PropertiesList(ret).Merge(PropertiesList(temp),
>     "IsRemovable") } //- if temp, err := runMount(); err != nil {
>     return ret, err } else {    ret =
>     PropertiesList(ret).Merge(PropertiesList(temp), "Label") } //-
>     return ret, nil }
> 

> 

> Does it mean i should nest those stmts and let it be 4 level deep ?

> Is it the reco ?

> 

> Is there something wrong about early returns ?

> 

> thanks

> 



> --

>  You received this message because you are subscribed to the Google
>  Groups "golang-nuts" group.
>  To unsubscribe from this group and stop receiving emails from it,
>  send an email to golang-nuts+unsubscr...@googlegroups.com.
>  For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to