Skip to content

Commit

Permalink
feat(pom): add line number definition for pomDependency
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jan 17, 2024
1 parent 043d802 commit 045287e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/java/pom/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,22 @@ func parsePom(r io.Reader) (*pomXML, error) {
}
return parsed, nil
}

func (deps *pomDependencies) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
*deps = pomDependencies{}
for {
var dep pomDependency
err := d.Decode(&dep)
if err == io.EOF {
break
} else if err != nil {
return err
}

endLine, _ := d.InputPos()
dep.endLine = endLine

(*deps).Dependency = append((*deps).Dependency, dep)
}
return nil
}
1 change: 1 addition & 0 deletions pkg/java/pom/pom.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ type pomDependency struct {
Scope string `xml:"scope"`
Optional bool `xml:"optional"`
Exclusions pomExclusions `xml:"exclusions"`
endLine int
}

type pomExclusions struct {
Expand Down

0 comments on commit 045287e

Please sign in to comment.