From 05bf80fc43e46490d0f5fda38859b3e6f2c050e3 Mon Sep 17 00:00:00 2001 From: m3ntalsp00n Date: Wed, 2 Sep 2020 12:51:05 +1000 Subject: [PATCH] fix: actually export the Dependency struct --- dependencies.go | 8 ++++---- deplist.go | 14 +++++++------- deplist_test.go | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dependencies.go b/dependencies.go index f9b564c..3cf8c2e 100644 --- a/dependencies.go +++ b/dependencies.go @@ -5,10 +5,10 @@ type Bitmask uint32 // Dependency per dependency info type Dependency struct { - depType int // golang, nodejs, python etc - path string // the module path, github.com/teris-io/shortid - version string // v0.0.0-20171029131806-771a37caa5cf - files []string // if available, list of all files for a package + DepType Bitmask // golang, nodejs, python etc + Path string // the module path, github.com/teris-io/shortid + Version string // v0.0.0-20171029131806-771a37caa5cf + Files []string // if available, list of all files for a package // /usr/lib/go-1.13/src/regexp/syntax/compile.go // /usr/lib/go-1.13/src/regexp/syntax/doc.go } diff --git a/deplist.go b/deplist.go index 2435a03..d9a9ac7 100644 --- a/deplist.go +++ b/deplist.go @@ -46,12 +46,12 @@ func GetDeps(fullPath string) ([]Dependency, Bitmask, error) { for _, p := range pkgs { d := Dependency{ - depType: langGolang, - path: p.PkgPath, - files: p.GoFiles, + DepType: langGolang, + Path: p.PkgPath, + Files: p.GoFiles, } if p.Module != nil { - d.version = p.Module.Version + d.Version = p.Module.Version } deps = append(deps, d) } @@ -68,9 +68,9 @@ func GetDeps(fullPath string) ([]Dependency, Bitmask, error) { splitIdx := strings.LastIndex(p, "@") d := Dependency{ - depType: langNodeJS, - path: p[:splitIdx], - version: p[splitIdx+1:], + DepType: langNodeJS, + Path: p[:splitIdx], + Version: p[splitIdx+1:], } deps = append(deps, d) } diff --git a/deplist_test.go b/deplist_test.go index af0de5b..b60ebed 100644 --- a/deplist_test.go +++ b/deplist_test.go @@ -105,20 +105,20 @@ func BuildWant() []Dependency { for _, n := range golangPaths { d := Dependency{ - depType: 1, - path: n, + DepType: 1, + Path: n, } deps = append(deps, d) } end := len(deps) - 2 // get the unicode ver - deps[end].version = "v0.3.3" + deps[end].Version = "v0.3.3" for _, n := range nodejsPaths { d := Dependency{ - depType: 2, - path: n, + DepType: 2, + Path: n, } deps = append(deps, d) } @@ -141,12 +141,12 @@ func TestGetDeps(t *testing.T) { } for i, pkg := range want { - if pkg.path != got[i].path { - t.Errorf("GetDeps() got %s; want %s", got[i].path, pkg.path) + if pkg.Path != got[i].Path { + t.Errorf("GetDeps() got %s; want %s", got[i].Path, pkg.Path) } - if pkg.version != "" && pkg.version != got[i].version { - t.Errorf("GetDeps() got %s %s; want %s %s", got[i].path, got[i].version, pkg.path, pkg.version) + if pkg.Version != "" && pkg.Version != got[i].Version { + t.Errorf("GetDeps() got %s %s; want %s %s", got[i].Path, got[i].Version, pkg.Path, pkg.Version) } } }