hugo.buildSite not propagating errors up the call stack

errors are just 'swallowed' currently
Thanks for letting me know Nate, I'll remember that.


On Mon, Aug 11, 2014 at 4:14 AM, Nate Finch <notifications@github.com>
wrote:

> In commands/hugo.go:
>
> > @@ -273,7 +273,7 @@ func buildSite(watching ...bool) (err error) {
> >  	}
> >  	err = site.Build()
> >  	if err != nil {
> > -		return
> > +		return err
>
> This actually is returning the error. This is called a "bare return" in
> Go. The return value is named in the function signature, which creates a
> variable with that name in the function, and always has a value that can be
> returned. If you specify return with no values after it, the function will
> return whatever is in the variable declared in the function signature. So,
> in this case, since the error for site.Build() is assigned the the err
> value in line 274, there actually is a value getting returned.
>
> That being said, using bare returns is generally considered bad
> practice.... but it's not actually logically incorrect.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/spf13/hugo/pull/398/files#r16047500>.
>



-- 

*franklin wise :: ceo & founder *
krave-n.com :: eat what you krave, love what you eat
franklin@krave-n.com :: 424.235.7283

*"stay hungry, stay foolish"*  - steve jobs