-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pom): add support of line numbers for deps from base pom.xml #287
feat(pom): add support of line numbers for deps from base pom.xml #287
Conversation
@@ -409,7 +433,7 @@ func (p *parser) mergeDependencies(parent, child []artifact, exclusions map[stri | |||
var deps []artifact | |||
unique := map[string]struct{}{} | |||
|
|||
for _, d := range append(parent, child...) { | |||
for _, d := range append(child, parent...) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go-dep-parser/pkg/java/pom/parse.go
Lines 325 to 328 in c95688d
// Merge dependencies. Child dependencies must be preferred than parent dependencies. | |
// Parents don't have to resolve dependencies. | |
deps := p.parseDependencies(pom.content.Dependencies.Dependency, props, depManagement, opts.depManagement, opts.exclusions) | |
deps = p.mergeDependencies(parent.dependencies, deps, opts.exclusions) |
Looks like it was a mistake.
I've updated test to show this:
https://github.com/aquasecurity/go-dep-parser/pull/287/files#diff-54393967b4dbd54d8dab7c5bf81ff4297c6fb825ff2bbf1805a4fdabec231146R44
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this approach?
https://go.dev/play/p/YYQZyFgD9Vt?v=
It works! |
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
@DmitriyLewen I refactored a bit so that we don't need to set nil to |
It looks good to me now. |
Description
Add support of line numbers for deps from base pom.xml.
This PR doesn't add line numbers for:
Related issues