forked from vito/gosub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.go
40 lines (30 loc) · 793 Bytes
/
list.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"github.com/codegangsta/cli"
)
func list(c *cli.Context) error {
appPackages := c.StringSlice("app")
testPackages := c.StringSlice("test")
appImports, err := getAppImports(appPackages...)
if err != nil {
return fmt.Errorf("failed to detect app imports: %s", err)
}
testImports, err := getTestImports(testPackages...)
if err != nil {
return fmt.Errorf("failed to detect test imports: %s", err)
}
allImports := append(appImports, testImports...)
allDeps, err := getAllDeps(allImports...)
if err != nil {
return fmt.Errorf("failed to get deps: %s", err)
}
deps, err := filterNonStandard(allDeps...)
if err != nil {
return fmt.Errorf("failed to filter deps: %s", err)
}
for _, dep := range deps {
fmt.Println(dep)
}
return nil
}