We are using the Sonar PR Scanner on branch builds within our Jenkin’s setup, but with certain Go-Lang based repositories, we are not getting any scan results to be reported.
I have mirrored my project’s scanner configuration after a coworkers other go-lang project similar to ours configurations. The errors that have been giving me issue are the following:
ERROR: Coverage report can’t be loaded, report file not found, ignoring this file reports/coverage.out.
ERROR: GoMetaLinterReportSensor: No issues information will be saved as the report file ‘/home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/master/reports/lint.txt’ can’t be read.
WARN: GoMetaLinterReportSensor: No input file found for src/controllers/runController_test.go. No GoMetaLinter issues will be imported on this file. java.nio.file.NoSuchFileException: /home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/master/reports/lint.txt
I have been thinking it has to do with the location of the reports files, but my attempts to fix this issue have not been successful.
Below are some points of info I think should give more context:
sonar.coverage.exclusions=** / * .json, ** / * .js,** / * .xml
Report Generation Scripts:
…to generate the report directory…
rm -rf “$reportDir”
mkdir -p “$reportDir”
…later followed by…
junitReport=“go-junit-report > $reportDir/report.xml”
goCov=“gocov convert $reportDir/coverage.out”
goCovXml=“gocov-xml > $reportDir/coverage.xml”
goHtml=“go tool cover -html=$reportDir/coverage.out -o $reportDir/coverage.html”
chmodVol=“chmod -R a+rwx $reportDir”
genReports=“cat $reportDir/report.txt | $junitReport && $goCov | $goCovXml && $goHtml && $chmodVol”
We then later run genReports after we run our unit tests.