update csi-lib-utils to v0.4.0

This commit is contained in:
Andrew Kim
2019-02-27 17:29:36 -05:00
committed by Andrew Sy Kim
parent 84cca93864
commit c20ded872e
41 changed files with 12952 additions and 1677 deletions

View File

@@ -24,6 +24,7 @@ import (
type moduleResolver struct {
env *fixEnv
initialized bool
main *moduleJSON
modsByModPath []*moduleJSON // All modules, ordered by # of path components in module Path...
modsByDir []*moduleJSON // ...or Dir.
@@ -48,7 +49,7 @@ type moduleErrorJSON struct {
}
func (r *moduleResolver) init() error {
if r.main != nil {
if r.initialized {
return nil
}
stdout, err := r.env.invokeGo("list", "-m", "-json", "...")
@@ -87,6 +88,7 @@ func (r *moduleResolver) init() error {
return count(j) < count(i) // descending order
})
r.initialized = true
return nil
}
@@ -202,7 +204,9 @@ func (r *moduleResolver) scan(_ references) ([]*pkg, error) {
// Walk GOROOT, GOPATH/pkg/mod, and the main module.
roots := []gopathwalk.Root{
{filepath.Join(r.env.GOROOT, "/src"), gopathwalk.RootGOROOT},
{r.main.Dir, gopathwalk.RootCurrentModule},
}
if r.main != nil {
roots = append(roots, gopathwalk.Root{r.main.Dir, gopathwalk.RootCurrentModule})
}
for _, p := range filepath.SplitList(r.env.GOPATH) {
roots = append(roots, gopathwalk.Root{filepath.Join(p, "/pkg/mod"), gopathwalk.RootModuleCache})