File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 3030 pkgmatch * regexp.Regexp
3131)
3232
33- func findImport (p string ) {
33+ func findImport (p string , rootp string ) {
3434 if ! pkgmatch .MatchString (p ) {
3535 // doesn't match the filter, skip it
3636 return
@@ -47,13 +47,13 @@ func findImport(p string) {
4747 p = path .Join ("vendor" , p )
4848 }
4949
50- pkg , err := build .Import (p , "" , 0 )
50+ pkg , err := build .Import (p , rootp , 0 )
5151 if err != nil {
5252 log .Fatal (err )
5353 }
5454 pkgs [p ] = filter (pkg .Imports )
5555 for _ , pkg := range pkgs [p ] {
56- findImport (pkg )
56+ findImport (pkg , rootp )
5757 }
5858}
5959
@@ -102,8 +102,14 @@ func check(err error) {
102102}
103103
104104func main () {
105+ var rootPkg * build.Package
106+ var e error
105107 for _ , pkg := range flag .Args () {
106- findImport (pkg )
108+ rootPkg , e = build .Import (pkg , "" , 0 )
109+ if e != nil {
110+ log .Fatal (e )
111+ }
112+ findImport (pkg , rootPkg .Dir )
107113 }
108114 cmd := exec .Command ("dot" , "-Tsvg" )
109115 in , err := cmd .StdinPipe ()
You can’t perform that action at this time.
0 commit comments