Handle errors to fix lint warnings

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-04-25 09:31:24 +02:00 committed by Cosmin Cojocar
parent ee73b9e94b
commit 950e84c3fa

View file

@ -109,10 +109,16 @@ func reportSonarqube(rootPath string, w io.Writer, data *reportInfo) error {
for _, issue := range data.Issues { for _, issue := range data.Issues {
lines := strings.Split(issue.Line, "-") lines := strings.Split(issue.Line, "-")
startLine, _ := strconv.Atoi(lines[0]) startLine, err := strconv.Atoi(lines[0])
if err != nil {
return err
}
endLine := startLine endLine := startLine
if len(lines) > 1 { if len(lines) > 1 {
endLine, _ = strconv.Atoi(lines[1]) endLine, err = strconv.Atoi(lines[1])
if err != nil {
return err
}
} }
s := sonarIssue{ s := sonarIssue{
EngineID: "gosec", EngineID: "gosec",