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/_CRQ86vHfq > > > On 16 March 2017 at 12:11, <mhh...@gmail.com <javascript:>> 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...@googlegroups.com <javascript:>. > > 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.