@@ -2,7 +2,13 @@ package golang
2
2
3
3
import (
4
4
"github.com/fossas/fossa-cli/analyzers/golang/resolver"
5
+ "github.com/fossas/fossa-cli/buildtools/dep"
6
+ "github.com/fossas/fossa-cli/buildtools/gdm"
7
+ "github.com/fossas/fossa-cli/buildtools/glide"
5
8
"github.com/fossas/fossa-cli/buildtools/gocmd"
9
+ "github.com/fossas/fossa-cli/buildtools/godep"
10
+ "github.com/fossas/fossa-cli/buildtools/govendor"
11
+ "github.com/fossas/fossa-cli/buildtools/vndr"
6
12
"github.com/fossas/fossa-cli/errutil"
7
13
"github.com/fossas/fossa-cli/log"
8
14
"github.com/fossas/fossa-cli/module"
@@ -25,20 +31,54 @@ func (a *Analyzer) Analyze(m module.Module) (module.Module, error) {
25
31
// Read lockfiles to get revisions.
26
32
var r resolver.Resolver
27
33
switch a .Options .Strategy {
28
- // Read revisions from a tool manifest at a specified location.
29
- // TODO: implement these strategies.
30
34
case "manifest:dep" :
31
- return m , errutil .ErrNotImplemented
35
+ if a .Options .LockfilePath == "" {
36
+ return m , errors .New ("manifest strategy specified without lockfile path" )
37
+ }
38
+ r , err = dep .FromFile (a .Options .LockfilePath )
39
+ if err != nil {
40
+ return m , err
41
+ }
32
42
case "manifest:gdm" :
33
- return m , errutil .ErrNotImplemented
43
+ if a .Options .LockfilePath == "" {
44
+ return m , errors .New ("manifest strategy specified without lockfile path" )
45
+ }
46
+ r , err = gdm .FromFile (a .Options .LockfilePath )
47
+ if err != nil {
48
+ return m , err
49
+ }
34
50
case "manifest:glide" :
35
- return m , errutil .ErrNotImplemented
51
+ if a .Options .LockfilePath == "" {
52
+ return m , errors .New ("manifest strategy specified without lockfile path" )
53
+ }
54
+ r , err = glide .FromFile (a .Options .LockfilePath )
55
+ if err != nil {
56
+ return m , err
57
+ }
36
58
case "manifest:godep" :
37
- return m , errutil .ErrNotImplemented
59
+ if a .Options .LockfilePath == "" {
60
+ return m , errors .New ("manifest strategy specified without lockfile path" )
61
+ }
62
+ r , err = godep .FromFile (a .Options .LockfilePath )
63
+ if err != nil {
64
+ return m , err
65
+ }
38
66
case "manifest:govendor" :
39
- return m , errutil .ErrNotImplemented
67
+ if a .Options .LockfilePath == "" {
68
+ return m , errors .New ("manifest strategy specified without lockfile path" )
69
+ }
70
+ r , err = govendor .FromFile (a .Options .LockfilePath )
71
+ if err != nil {
72
+ return m , err
73
+ }
40
74
case "manifest:vndr" :
41
- return m , errutil .ErrNotImplemented
75
+ if a .Options .LockfilePath == "" {
76
+ return m , errors .New ("manifest strategy specified without lockfile path" )
77
+ }
78
+ r , err = vndr .FromFile (a .Options .LockfilePath )
79
+ if err != nil {
80
+ return m , err
81
+ }
42
82
43
83
// Resolve revisions by traversing the local $GOPATH and calling the package's
44
84
// VCS.
0 commit comments