loov / goda

Go Dependency Analysis toolkit
MIT License
1.37k stars 45 forks source link

avoid test packages in cut output #52

Open rogpeppe opened 3 years ago

rogpeppe commented 3 years ago

When I run goda cut, I see a lot of test package results like this:

github.com/influxdata/idpe/client/v2 [github.com/influxdata/idpe/client/v2.test]                                                                            in:0     pkgs:1   size:45.6KB    loc:1499
github.com/influxdata/idpe/client/v2.test                                                                                                                   in:0     pkgs:1   size:2.9KB     loc:58
github.com/influxdata/idpe/client/v2_test [github.com/influxdata/idpe/client/v2.test]                                                                       in:0     pkgs:1   size:6.0KB     loc:234
github.com/influxdata/idpe/client/v2                                                                                                                        in:24    pkgs:1   size:21.3KB    loc:706

There's actually only one package there, but it's appearing multiple times in the results (because of the external test shenanigans).

It's probably not helpful to include these entries in the cut results because it's unlikely we're going to consider removing tests.

In fact, these results are kinda confusing all round unless you're familiar with the way that test packages are dealt with. I know these package need to be a part of the package sets internally, but I wonder if there might be a way to hide them from user view, at least most of the time?

egonelbre commented 3 years ago

I'm wondering whether cut needs a separate "-show" or "-hide" flag for filtering the output. So you can do something like:

goda cut -show -:test ./...:+test:all
goda cut -hide :test ./...:+test:all