Skip to content

Commit

Permalink
Store the raw go/build output on each Pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleBanks committed Mar 25, 2017
1 parent 1cc2c95 commit 5e7e54e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions depth.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
// ResolveTest: true,
// MaxDepth: 10,
// }
//
// err := t.Resolve("strings")
// err := t.Resolve("strings")
package depth

import (
Expand Down
2 changes: 2 additions & 0 deletions depth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func TestTree_Resolve(t *testing.T) {
t.Fatal("Expected positive number of Deps")
} else if len(tr.Root.SrcDir) == 0 {
t.Fatal("Expected SrcDir to be populated")
} else if tr.Root.Raw == nil {
t.Fatal("Expected non-nil Raw")
}

// Reuse the same tree and the same package to ensure that the internal pkg cache
Expand Down
3 changes: 3 additions & 0 deletions pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type Pkg struct {
Tree *Tree `json:"-"`
Parent *Pkg `json:"-"`
Deps []Pkg `json:"deps"`

Raw *build.Package `json:"-"`
}

// Resolve recursively finds all dependencies for the Pkg and the packages it depends on.
Expand All @@ -44,6 +46,7 @@ func (p *Pkg) Resolve(i Importer) {
p.Resolved = false
return
}
p.Raw = pkg

// Update the name with the fully qualified import path.
p.Name = pkg.ImportPath
Expand Down

0 comments on commit 5e7e54e

Please sign in to comment.