Skip to content

Commit 33d93ed

Browse files
committed
refactor: maven find_modules use generic list
1 parent b2f70fa commit 33d93ed

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

module/maven/find_modules.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package maven
22

33
import (
4-
"container/list"
54
"context"
5+
list "github.com/bahlo/generic-list-go"
66
"github.com/murphysecurity/murphysec/infra/logctx"
77
"go.uber.org/zap"
88
"path/filepath"
@@ -15,14 +15,14 @@ func ReadLocalProject(ctx context.Context, dir string) ([]*UnresolvedPom, error)
1515
// Workaround for Maven CI Friendly Versions: https://maven.apache.org/maven-ci-friendly.html
1616
var revisionMap = map[string]string{}
1717

18-
var moduleQ = list.New()
18+
var moduleQ = list.New[string]()
1919
moduleQ.PushBack(dir)
2020

2121
var projectPomList []*UnresolvedPom
2222

2323
var visitedPath = make(map[string]bool)
2424
for moduleQ.Len() > 0 {
25-
current := moduleQ.Front().Value.(string)
25+
current := moduleQ.Front().Value
2626
moduleQ.Remove(moduleQ.Front())
2727

2828
if visitedPath[current] {
@@ -58,6 +58,12 @@ func ReadLocalProject(ctx context.Context, dir string) ([]*UnresolvedPom, error)
5858
moduleQ.PushBack(filepath.Join(current, module))
5959
}
6060

61+
for _, profile := range pom.Profiles {
62+
for _, module := range profile.Modules {
63+
moduleQ.PushBack(filepath.Join(current, module))
64+
}
65+
}
66+
6167
projectPomList = append(projectPomList, &UnresolvedPom{pom, pomPath})
6268
}
6369

0 commit comments

Comments
 (0)