And now for my next trick ...
roger peppe
rogpeppe at gmail.com
Wed Jul 16 21:08:51 UTC 2014
Nice (and good to get some familiarity with go/ast).
You might want to check out github.com/kisielk/errcheck, which
does a similar thing, but using the types package, so
it can do a somewhat more comprehensive check.
It's a lot slower though.
Here's the output when running it on juju-core:
http://paste.ubuntu.com/7805613/
cheers,
rog.
On 16 July 2014 21:39, Jesse Meek <jesse.meek at canonical.com> wrote:
> After checking the import grouping I became curious as to what else I could
> check. So, while on holiday, I wrote another script to check if errors are
> being discarded. It uses the ast package to check for both assignment
> statements, where a value of type "error" is being assigned to a variable of
> name "_" and non-assignment expression statements that return at least one
> value of type "error".
>
> The results were disappointing, for me, but good for Juju. It only picked up
> one case:
>
> environs/config.go:48-51
>
> p, _ := Provider(kind)
> if p == nil {
> return fmt.Errorf("environment %q has an unknown provider type %q",
> rawEnviron["name"], kind)
> }
>
> So, not a huge revelation, but good to know we are not discarding errors at
> least. :)
>
> --
> Juju-dev mailing list
> Juju-dev at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
More information about the Juju-dev
mailing list